fix: 修复asset无法新增的问题

This commit is contained in:
陈劲松
2020-03-03 20:50:50 +08:00
parent 111c089b28
commit fec2ed16c0
5 changed files with 41 additions and 25 deletions

View File

@@ -275,7 +275,8 @@
} else if (item.type == 5) { } else if (item.type == 5) {
this.$refs.alertConfigBox.show(true, true); this.$refs.alertConfigBox.show(true, true);
} else if (item.type == 4) { } else if (item.type == 4) {
this.addUnitShow = true this.addUnitShow = true;
this.$refs.assetAddUnit.resetAsset();
} }
}, },
jumpToAsset(id) { jumpToAsset(id) {

View File

@@ -516,7 +516,7 @@
response.data.list[i].paramObj.push({key: k, value: tempObj[k]}) response.data.list[i].paramObj.push({key: k, value: tempObj[k]})
} }
} catch(err) { } catch(err) {
console.info(response.data.list[i], err); //console.info(response.data.list[i], err);
} }
} }
this.moduleList = response.data.list; this.moduleList = response.data.list;

View File

@@ -722,25 +722,7 @@
} }
}) })
} else { } else {
this.pageObj.id = ''; this.resetAsset();
this.assetData = {
id: '',
sn: '',
host: '',
state: '',
purchaseDate: '',
idcId: '',
cabinetId: '',
modelId: '',
assetType: '',
accounts: [{
id: '',
authType: 1,
user: '',
pwd: '',
port: '',
}]
};
} }
}, },
openModuleBox(module) { openModuleBox(module) {
@@ -807,7 +789,7 @@
getModelOptionData(assetType, vendorCode) { getModelOptionData(assetType, vendorCode) {
this.$get('model?typeCode=' + assetType + '&vendorCode=' + vendorCode).then(response => { this.$get('model?typeCode=' + assetType + '&vendorCode=' + vendorCode).then(response => {
if (response.code === 200) { if (response.code === 200) {
this.modelUlData = response.data.list this.modelUlData = response.data.list;
this.markOptionData(this.modelUlData) this.markOptionData(this.modelUlData)
} }
}) })
@@ -820,6 +802,35 @@
} }
}) })
}, },
resetAsset() {
this.pageObj.id = '';
this.assetData = {
id: '',
sn: '',
host: '',
state: '',
purchaseDate: '',
idcId: '',
cabinetId: '',
modelId: '',
assetType: '',
accounts: [{
id: '',
authType: 1,
user: '',
pwd: '',
port: '',
}]
};
this.assetType = '';
this.idcSelectedData = {
id: '',
name: '',
location: '',
principal: '',
tel: ''
}
},
editData(data, item, mark) { editData(data, item, mark) {
let obj = { let obj = {
id: '', id: '',
@@ -835,7 +846,10 @@
tel: '' tel: ''
} }
if (data === 'asset') { if (data === 'asset') {
if (this.assetData.modelId) {
console.info(this.assetData.modelId)
this.assetData.modelId = this.assetData.modelId.join(',').split(',')[1]; this.assetData.modelId = this.assetData.modelId.join(',').split(',')[1];
}
// let modelId = this.assetData.modelId.join(',').split(',')[1]; // let modelId = this.assetData.modelId.join(',').split(',')[1];
// let form = new FormData(); // let form = new FormData();
// form.append("id", this.pageObj.id); // form.append("id", this.pageObj.id);
@@ -870,7 +884,7 @@
if (valid&&this.accountValideResult) { if (valid&&this.accountValideResult) {
if (this.pageObj.id) { if (this.pageObj.id) {
this.assetData.id=this.pageObj.id; this.assetData.id=this.pageObj.id;
console.log(JSON.stringify(this.assetData)); //console.log(JSON.stringify(this.assetData));
this.$put('asset', this.assetData).then(res => { this.$put('asset', this.assetData).then(res => {
const h = this.$createElement; const h = this.$createElement;
if (res.code === 200) { if (res.code === 200) {

View File

@@ -348,7 +348,7 @@
response.data.list[i].paramObj.push({key: k, value: tempObj[k]}) response.data.list[i].paramObj.push({key: k, value: tempObj[k]})
} }
} catch(err) { } catch(err) {
console.info(response.data.list[i], err); //console.info(response.data.list[i], err);
} }
} }
this.moduleList = response.data.list; this.moduleList = response.data.list;

View File

@@ -638,6 +638,7 @@
//this.addUnitShow = true; //this.addUnitShow = true;
this.editUnitShow = true; this.editUnitShow = true;
this.$refs['assetEditUnit'].getAssetData(''); this.$refs['assetEditUnit'].getAssetData('');
this.$refs['assetEditUnit'].resetAsset();
} }
if (data === 'showEdit') { if (data === 'showEdit') {
this.editUnitShow = true; this.editUnitShow = true;