刘向辉 3 years ago
parent
commit
a7e50da827
  1. 9
      src/app/pages/left-domain/left-domain.component.html
  2. 23
      src/app/pages/left-domain/left-domain.component.ts

9
src/app/pages/left-domain/left-domain.component.html

@ -209,21 +209,22 @@
<nz-modal nzClassName="baseInfoDialog" [(nzVisible)]="isShowBaseDialog" nzFooter="null" (nzOnCancel)="closeBaseInfoDialog()" nzWidth="70%">
<app-oil-station-info *ngIf="isShowBaseDialog"></app-oil-station-info>
</nz-modal>
<nz-modal [(nzVisible)]="addDisposalPop || addNodePop" nzTitle="创建预案/节点" (nzOnCancel)="addDisposalPop = false; addNodePop = null;" (nzOnOk)="addDisposal(form.value)" [nzOkDisabled]='nodeName.invalid'>
<nz-modal [(nzVisible)]="addDisposalPop || addNodePop" nzTitle="创建预案/节点" (nzOnCancel)="addDisposalPop = false; addNodePop = null;" (nzOnOk)="addDisposal(form.value)">
<form nz-form #form='ngForm'>
<nz-form-item>
<nz-form-label [nzSpan]="6">预案/节点名称</nz-form-label>
<nz-form-control [nzSpan]="18" nzErrorTip="请输入必填项">
<input nz-input #nodeName='ngModel' ngModel name="name" required/>
<input nz-input #nodeName='ngModel' ngModel name="name"/>
</nz-form-control>
</nz-form-item>
<nz-form-item *ngIf="addDisposalPop">
<nz-form-label [nzSpan]="6">选取模板</nz-form-label>
<nz-form-control>
<nz-select ngModel name="selectMould">
<nz-select [(ngModel)]="selectMould" name="selectMould">
<nz-option nzValue="" nzLabel="无"></nz-option>
<nz-option [nzValue]="item.id" [nzLabel]="item.name" *ngFor="let item of allSandBoxTemplate"></nz-option>
</nz-select>
<button nz-button style="margin-top: 5px;" (click)="deleteMould(form.value)" *ngIf="userMode">删除模板</button>
</nz-form-control>
</nz-form-item>
</form>
@ -238,7 +239,7 @@
</nz-form-item>
</form>
<div *nzModalFooter>
<button nz-button nzType="primary" (click)="saveMould()">保存为模板</button>
<button nz-button nzType="primary" (click)="saveMould()" *ngIf="userMode">保存为模板</button>
<button nz-button nzType="default" (click)="editSelectDisposal = null;">取消</button>
<button nz-button nzType="primary" (click)="editDisposal(editForm.value)">确定</button>
</div>

23
src/app/pages/left-domain/left-domain.component.ts

@ -33,6 +33,7 @@ export class LeftDomainComponent implements OnInit {
}
editMode: boolean = true; //编辑/查看模式
userMode: boolean = ModeManager.s_isMakeMode; //是否为 内部权限
beforeFence: number; //当前选中功能栏
FacilityList: FacilityInfoUIItem[] = []; //统计设备 list
selectFacilityId: string = null; //选中设备 ID
@ -253,10 +254,18 @@ export class LeftDomainComponent implements OnInit {
MarkWindow.instance.addMarkPlanByTemplate(e.selectMould)
this.addDisposalPop = false
} else {
if (!e.name) {
this.message.info('请填写名称!');
return
}
MarkWindow.instance.createMarkPlaneData(e.name)
this.addDisposalPop = false
}
} else { //创建节点
if (!e.name) {
this.message.info('请填写名称!');
return
}
MarkWindow.instance.createMarkNodeData(this.addNodePop, e.name)
this.addNodePop = null
}
@ -271,6 +280,20 @@ export class LeftDomainComponent implements OnInit {
this.addNodePop = id
}
selectMould: number = 0; //当前选择模板
//删除模板
deleteMould(e) {
if (e.selectMould) {
let isTrue = confirm('您确定要删除当前选中模板吗')
if (isTrue) {
MarkWindow.instance.deleteSandBoxTemplate(e.selectMould)
this.allSandBoxTemplate.splice(this.allSandBoxTemplate.findIndex(item => item.id === e.selectMould), 1)
this.selectMould = 0
}
}
}
//保存为模板
saveMould() {
MarkWindow.instance.saveToSandBoxTemplate(this.editSelectDisposal)

Loading…
Cancel
Save