diff --git a/nezha-fronted/src/components/common/rightBox/assetBox.vue b/nezha-fronted/src/components/common/rightBox/assetBox.vue index e04b57bfa..0035eac7e 100644 --- a/nezha-fronted/src/components/common/rightBox/assetBox.vue +++ b/nezha-fronted/src/components/common/rightBox/assetBox.vue @@ -126,6 +126,32 @@ {{assetData.purchaseDate}} + + + +
+ +
+ + + + = + + + + +
+
+
+
{{$t('asset.createAssetTab.cli')}} @@ -291,6 +246,7 @@ passwordTip:'', reloginPasswordTip:'' }], + tags: [], exporter: 0 }, modelSize:1, @@ -546,6 +502,15 @@ this.getAssetTypeOptionData(); } }, + addTag() { + this.assetData.tags.push({tag: "", value: ""}); + }, + removeTag: function(index) { + this.assetData.tags.splice(index, 1); + this.$nextTick(() => { + this.$refs.paramBoxScrollbar.update(); + }); + }, clickOutSide(data) { if (data) { this.editQuit(); @@ -593,10 +558,9 @@ },100) }, modelChange:function(ids){ - let modelId=ids[1]; let model=this.allModelUlData.find((item,index)=>{ - return modelId==item.id; - }) + return ids==item.id; + }); this.modelSize=model.usize; }, getAssetData(data) { @@ -625,7 +589,8 @@ this.assetData.sn = this.obj.sn this.assetData.host = this.obj.host this.assetData.state = this.obj.state - this.assetData.idcId = this.obj.idc.id + this.assetData.idcId = this.obj.idc.id; + this.assetData.tags = this.obj.tags; this.assetData.cabinetId = this.obj.cabinet == null ? '' : this.obj.cabinet.id this.assetData.purchaseDate = this.obj.purchaseDate; // this.assetData.accounts[0].id = this.obj.accounts[0].id @@ -828,7 +793,8 @@ userTip:"", passwordTip:'', reloginPasswordTip:'' - }] + }], + tags: [] }; this.assetType = ''; this.idcSelectedData = { @@ -855,9 +821,6 @@ }; if (data === 'asset') { - /*if (this.assetData.modelId) { - this.assetData.modelId = this.assetData.modelId.join(',').split(',')[1]; - }*/ if(this.locationInfo){ if(this.locationInfo.idc){ this.assetData.idcId=this.locationInfo.idc.id; @@ -871,32 +834,9 @@ } } - // let modelId = this.assetData.modelId.join(',').split(',')[1]; - // let form = new FormData(); - // form.append("id", this.pageObj.id); - // form.append("sn", this.assetData.sn); - // form.append("host", this.assetData.host); - // form.append("state", this.assetData.state); - // form.append("purchaseDate", !this.assetData.purchaseDate?'':this.assetData.purchaseDate); - // form.append("idcId", this.assetData.idcId); - // form.append("cabinetId", this.assetData.cabinetId); - // form.append("modelId", modelId); if (!this.accountSwitch) { this.assetData.accounts = []; } - // for(let i in this.assetData.accounts){ - // let account=this.assetData.accounts[i]; - // if(account.user){ - // if (account.id) { - // form.append("accounts["+i+"].id", account.id); - // } - // form.append("accounts["+i+"].authType",account.authType); - // form.append("accounts["+i+"].user", account.user); - // form.append("accounts["+i+"].port", account.port); - // form.append("accounts["+i+"].pwd", account.pwd); - // form.append("accounts["+i+"].privateKey", account.privateKey); - // } - // } if(this.$refs.accountConfigBox&&this.$refs.accountConfigBox.length>0){ this.$refs.accountConfigBox[0].validateAccount(); @@ -907,18 +847,16 @@ if (this.pageObj.id) { this.assetData.id=this.pageObj.id; let reqData = JSON.parse(JSON.stringify(this.assetData)); - // if (reqData.modelId) { - // reqData.modelId = reqData.modelId.join(',').split(',')[1]; - // } + if (typeof reqData.modelId == "object") { + reqData.modelId = reqData.modelId[1]; + } this.$put('asset', reqData).then(res => { - const h = this.$createElement; if (res.code === 200) { this.$message({duration: 2000, type: 'success', message: this.$t("tip.saveSuccess")}); this.pageObj.id = ''; this.$emit('refreshData', 'true'); this.sendStateData('close'); } else { - //this.assetData.modelId = tempModelId; this.$message.error(res.msg); } }); @@ -926,53 +864,17 @@ if(this.$refs.accountConfigBox&&this.$refs.accountConfigBox.length>0){ this.$refs.accountConfigBox[0].validateAccount(); } - let modelId = '' - // let authType = '' - // if (this.assetData.modelId !== '') { - // modelId = this.assetData.modelId.join(',').split(',')[1] - // } else { - // this.assetData.modelId = '' - // } - // if (this.assetData.accounts[0].user === '') { - // authType = '' - // } else { - // authType = this.assetData.accounts[0].authType - // } - // let form = new FormData(); - // form.append("sn", this.assetData.sn); - // form.append("host", this.assetData.host); - // form.append("state", this.assetData.state); - // form.append("purchaseDate", !this.assetData.purchaseDate?'':this.assetData.purchaseDate); - // form.append("idcId", this.assetData.idcId); - // form.append("cabinetId", this.assetData.cabinetId); - // form.append("modelId", modelId); - // if(this.accountSwitch){ - // for(let i in this.assetData.accounts){ - // let account=this.assetData.accounts[i]; - // if(account.user){ - // form.append("accounts["+i+"].authType",account.authType); - // form.append("accounts["+i+"].user", account.user); - // form.append("accounts["+i+"].port", account.port); - // form.append("accounts["+i+"].pwd", account.pwd); - // form.append("accounts["+i+"].privateKey", account.privateKey) - // } - // } - // } - // form.append("exporter",parseInt(this.assetData.exporter)); this.$post('asset', this.assetData).then(res => { - const h = this.$createElement; if (res.code === 200) { this.$message({duration: 2000, type: 'success', message: this.$t("tip.saveSuccess")}); this.$emit('refreshData', 'true'); this.sendStateData('close'); } else { - // this.assetData.modelId = tempModelId; this.$message.error(res.msg); } }); } } else { - // this.assetData.modelId = tempModelId; return false; } });