|
@@ -228,49 +228,29 @@ export default {
|
|
|
this.$message.info("存在设备的本地名称为空,请检查")
|
|
|
return;
|
|
|
}
|
|
|
- let params = { projectId: this.projectId }
|
|
|
|
|
|
for (let i = 0; i < newData.length; i++) {
|
|
|
+ let params = { projectId: this.projectId }
|
|
|
let data = {
|
|
|
ParentId: this.category.deviceId, //当前设备id
|
|
|
Category: this.category.Code //当前部件分类
|
|
|
};
|
|
|
params.data = Object.assign(data, newData[i]);
|
|
|
- // await createPart(params).then(res => {
|
|
|
- // let response = res;
|
|
|
- // if(response.Result=='success'){
|
|
|
- // if(newData[i].Checked){//同时创建资产
|
|
|
- // params.data.EquipmentId = response.Id
|
|
|
- // createPropertyData(params);
|
|
|
- // }
|
|
|
- // if(i==newData.length-1){
|
|
|
- // this.$router.push({
|
|
|
- // path: "/ledger/partsmanage",
|
|
|
- // query: {
|
|
|
- // deviceId: this.category.deviceId,
|
|
|
- // typeId: this.category.ParentId
|
|
|
- // }
|
|
|
- // });
|
|
|
- // session.remove("partsAddData")
|
|
|
- // }
|
|
|
- // }
|
|
|
- // });
|
|
|
if(newData[i].Checked){//同时创建资产
|
|
|
- await createPropertyData(params, res => {
|
|
|
- let response = res;
|
|
|
- params.data.PropertyId = response.Id;
|
|
|
- })
|
|
|
- await createPart(params, res=>{
|
|
|
- if(i==newData.length-1){
|
|
|
- this.$router.push({
|
|
|
- path: "/ledger/partsmanage",
|
|
|
- query: {
|
|
|
- deviceId: this.category.deviceId,
|
|
|
- typeId: this.category.ParentId
|
|
|
- }
|
|
|
- });
|
|
|
- session.remove("partsAddData")
|
|
|
- }
|
|
|
+ await createPropertyData(params, async res => {
|
|
|
+ params.data.PropertyId = res.Id
|
|
|
+ await createPart(params, res=>{
|
|
|
+ if(i==newData.length-1){
|
|
|
+ this.$router.push({
|
|
|
+ path: "/ledger/partsmanage",
|
|
|
+ query: {
|
|
|
+ deviceId: this.category.deviceId,
|
|
|
+ typeId: this.category.ParentId
|
|
|
+ }
|
|
|
+ });
|
|
|
+ session.remove("partsAddData")
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
}else{
|
|
|
await createPart(params, res=>{
|