|
|
|
@ -11,6 +11,7 @@ import { TreeService } from 'src/app/service/tree.service';
|
|
|
|
|
}) |
|
|
|
|
export class WorkerTagComponent implements OnInit { |
|
|
|
|
@Input() tree: any; |
|
|
|
|
@Input() type: number; |
|
|
|
|
@ViewChild('nzTreeComponent', { static: false }) |
|
|
|
|
nzTreeComponent!: NzTreeComponent; |
|
|
|
|
defaultCheckedKeys = []; |
|
|
|
@ -66,6 +67,9 @@ export class WorkerTagComponent implements OnInit {
|
|
|
|
|
addInput() { |
|
|
|
|
this.inputList.push({ value: '' }); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
oldValue: string; |
|
|
|
|
newValue: string; |
|
|
|
|
ok() { |
|
|
|
|
let ids = |
|
|
|
|
this.nzTreeComponent.getCheckedNodeList().map((item) => { |
|
|
|
@ -80,9 +84,17 @@ export class WorkerTagComponent implements OnInit {
|
|
|
|
|
this.message.create('info', '请至少选择一个加油站'); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (this.inputList.find((v) => !v.value)) { |
|
|
|
|
this.message.create('info', '请将所有输入框填写完整'); |
|
|
|
|
return; |
|
|
|
|
if (this.type == 1) { |
|
|
|
|
if (this.inputList.find((v) => !v.value)) { |
|
|
|
|
this.message.create('info', '请将所有输入框填写完整'); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (this.type == 2) { |
|
|
|
|
if (!this.oldValue || !this.newValue) { |
|
|
|
|
this.message.create('info', '请将所有输入框填写完整'); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
let _this = this; |
|
|
|
|
function BatchModifyWorkerTags() { |
|
|
|
@ -104,6 +116,30 @@ export class WorkerTagComponent implements OnInit {
|
|
|
|
|
}); |
|
|
|
|
return a; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function BatchModifyoi() { |
|
|
|
|
var a = new Promise<void>((resolve, reject) => { |
|
|
|
|
let obj = { |
|
|
|
|
replaceString: _this.newValue, |
|
|
|
|
targetString: _this.oldValue, |
|
|
|
|
}; |
|
|
|
|
_this.http |
|
|
|
|
.put('/api/EdgeDevices/BatchModifyConfig', ids, { |
|
|
|
|
params: obj, |
|
|
|
|
}) |
|
|
|
|
.subscribe({ |
|
|
|
|
next: (data: any) => { |
|
|
|
|
_this.message.create('success', '批量修改成功'); |
|
|
|
|
resolve(data); |
|
|
|
|
}, |
|
|
|
|
error: (err) => { |
|
|
|
|
// _this.message.create('error', '批量修改失败,请重试');
|
|
|
|
|
reject(err); |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
return a; |
|
|
|
|
} |
|
|
|
|
function BatchPushFile() { |
|
|
|
|
let b = new Promise<void>((resolve, reject) => { |
|
|
|
|
_this.http |
|
|
|
@ -123,10 +159,20 @@ export class WorkerTagComponent implements OnInit {
|
|
|
|
|
}); |
|
|
|
|
return b; |
|
|
|
|
} |
|
|
|
|
BatchModifyWorkerTags() |
|
|
|
|
.then((data) => { |
|
|
|
|
BatchPushFile(); |
|
|
|
|
}) |
|
|
|
|
.catch((err) => {}); |
|
|
|
|
|
|
|
|
|
if (this.type == 1) { |
|
|
|
|
BatchModifyWorkerTags() |
|
|
|
|
.then((data) => { |
|
|
|
|
BatchPushFile(); |
|
|
|
|
}) |
|
|
|
|
.catch((err) => {}); |
|
|
|
|
} |
|
|
|
|
if (this.type == 2) { |
|
|
|
|
BatchModifyoi() |
|
|
|
|
.then((data) => { |
|
|
|
|
BatchPushFile(); |
|
|
|
|
}) |
|
|
|
|
.catch((err) => {}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|