Browse Source

合并代码

develop
陈鹏飞 3 years ago
parent
commit
3c98642b17
  1. 11009
      package-lock.json
  2. 17
      src/app/pipe/cameraTypePipe.ts
  3. 129
      src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.html
  4. 4
      src/app/system-management/host-config/addcamera/addcamera.component.html
  5. 2
      src/app/system-management/host-config/addcamera/addcamera.component.ts
  6. 4
      src/app/system-management/host-config/editcamera/editcamera.component.html
  7. 2
      src/app/system-management/host-config/editcamera/editcamera.component.ts
  8. 80
      src/app/system-management/host-config/host-config.component.html
  9. 77
      src/app/system-management/host-config/host-config.component.ts
  10. 8
      src/app/system-management/system-management.module.ts

11009
package-lock.json generated

File diff suppressed because it is too large Load Diff

17
src/app/pipe/cameraTypePipe.ts

@ -0,0 +1,17 @@
import { Pipe, PipeTransform } from '@angular/core';
/*
* Raise the value exponentially
* Takes an exponent argument that defaults to 1.
* Usage:
* value | exponentialStrength:exponent
* Example:
* {{ 2 | exponentialStrength:10 }}
* formats to: 1024
*/
@Pipe({ name: 'cameraType' })
export class cameraType implements PipeTransform {
transform(value: number): string {
let arr = ['收银区', '进口', '出口', '卸油区', '加油区1', '加油区2', '加油区3', '加油区4']
return arr[value]
}
}

129
src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.html

@ -1,71 +1,70 @@
<div class="bigbox" id="hostbox">
<div class="orbox">
<div class="topbox">
<div class="lefttop">
<span>组织机构列表</span>
</div>
<div class="righttop">
<nz-input-group nzPrefixIcon="search">
<input type="text" nz-input placeholder="请输入机构名称" [(ngModel)]="searchValue" />
</nz-input-group>
</div>
</div>
<div class="treeTitle">
<span>组织机构</span>
<div class="orbox">
<div class="topbox">
<div class="lefttop">
<span>组织机构列表</span>
</div>
<div class="righttop">
<nz-input-group nzPrefixIcon="search">
<input type="text" nz-input placeholder="请输入机构名称" [(ngModel)]="searchValue" />
</nz-input-group>
</div>
</div>
<div class="treeTitle">
<span>组织机构</span>
</div>
<div class="treebox">
<nz-tree [nzSearchValue]="searchValue" #nzTreeComponent [nzData]="nodes" [nzExpandAll]="nzExpandAll"
[nzExpandedKeys]="defaultExpandedKeys" [nzSelectedKeys]='nzSelectedKeys' (nzClick)="nzClick($event)"
[nzTreeTemplate]="nzTreeTemplate" [nzExpandedIcon]="multiExpandedIconTpl">
</nz-tree>
<ng-template #nzTreeTemplate let-node let-origin="origin">
<div class="nodebox">
<span class="name">{{ node.title }}</span>
</div>
<div class="treebox">
<nz-tree [nzSearchValue]="searchValue" #nzTreeComponent [nzData]="nodes" [nzExpandAll]="nzExpandAll"
[nzExpandedKeys]="defaultExpandedKeys" [nzSelectedKeys]='nzSelectedKeys' (nzClick)="nzClick($event)"
[nzTreeTemplate]="nzTreeTemplate" [nzExpandedIcon]="multiExpandedIconTpl">
</nz-tree>
<ng-template #nzTreeTemplate let-node let-origin="origin">
<div class="nodebox">
<span class="name">{{ node.title }}</span>
</div>
</ng-template>
<ng-template #multiExpandedIconTpl let-node let-origin="origin">
<ng-container *ngIf="node.children.length == 0; else elseTemplate">
</ng-template>
<ng-template #multiExpandedIconTpl let-node let-origin="origin">
<ng-container *ngIf="node.children.length == 0; else elseTemplate">
</ng-container>
<ng-template #elseTemplate>
<i nz-icon [nzType]="node.isExpanded ? 'caret-down' : 'caret-right'"
class="ant-tree-switcher-line-icon"></i>
</ng-template>
</ng-template>
</div>
</ng-container>
<ng-template #elseTemplate>
<i nz-icon [nzType]="node.isExpanded ? 'caret-down' : 'caret-right'" class="ant-tree-switcher-line-icon"></i>
</ng-template>
</ng-template>
</div>
</div>
<div class="hostListbox">
<div class="topbox">
<div class="lefttop">
<span>{{selectedOilStation ? selectedOilStation.displayName : '加油站'}} 分析主机列表
<span class="yellowspan">(请从左侧选择加油站)</span>
</span>
</div>
<div class="righttop" *ngIf="selectedOilStation">
<button nz-button nzType="primary" (click)="addHost()"><i nz-icon nzType="plus-circle"
nzTheme="outline"></i>新增分析主机</button>
</div>
</div>
<div class="hostListbox">
<div class="topbox">
<div class="lefttop">
<span>{{selectedOilStation ? selectedOilStation.displayName : '加油站'}} 分析主机列表
<span class="yellowspan">(请从左侧选择加油站)</span>
</span>
</div>
<div class="righttop" *ngIf="selectedOilStation">
<button nz-button nzType="primary" (click)="addHost()"><i nz-icon nzType="plus-circle"
nzTheme="outline"></i>新增分析主机</button>
</div>
</div>
<div class="tablebox">
<nz-table #basicTable [nzData]="listOfData" [nzShowPagination]='false' [nzPageSize]='16'>
<thead>
<tr>
<th>ip</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of basicTable.data">
<td>{{data.hostIPAddress}}</td>
<td class="operation">
<a (click)="edit(data)" style="margin-right: 12px;">编辑</a>
<a (click)="config(data)" style="margin-right: 12px;">配置</a>
<a (click)="delete(data)">删除</a>
</td>
</tr>
</tbody>
</nz-table>
</div>
<div class="tablebox">
<nz-table #basicTable [nzData]="listOfData" [nzShowPagination]='false' [nzPageSize]='16'>
<thead>
<tr>
<th>ip</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of basicTable.data">
<td>{{data.hostIPAddress}}</td>
<td class="operation">
<a (click)="edit(data)" style="margin-right: 12px;">编辑</a>
<a (click)="config(data)" style="margin-right: 12px;">配置</a>
<a (click)="delete(data)">删除</a>
</td>
</tr>
</tbody>
</nz-table>
</div>
</div>
</div>
</div>

4
src/app/system-management/host-config/addcamera/addcamera.component.html

@ -25,10 +25,10 @@
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="url">地址</nz-form-label>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="uri">地址</nz-form-label>
<nz-form-control>
<nz-input-group>
<input nz-input type="text" formControlName="url" placeholder="请输入地址" />
<input nz-input type="text" formControlName="uri" placeholder="请输入地址" />
</nz-input-group>
</nz-form-control>
</nz-form-item>

2
src/app/system-management/host-config/addcamera/addcamera.component.ts

@ -17,7 +17,7 @@ export class AddcameraComponent implements OnInit {
name: [null, [Validators.required]],
user: [null, [Validators.required]],
password: [null, [Validators.required]],
url: [null, [Validators.required]],
uri: [null, [Validators.required]],
type: [null, [Validators.required]]
});
}

4
src/app/system-management/host-config/editcamera/editcamera.component.html

@ -25,10 +25,10 @@
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="url">地址</nz-form-label>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="uri">地址</nz-form-label>
<nz-form-control>
<nz-input-group>
<input nz-input type="text" formControlName="url" placeholder="请输入地址" />
<input nz-input type="text" formControlName="uri" placeholder="请输入地址" />
</nz-input-group>
</nz-form-control>
</nz-form-item>

2
src/app/system-management/host-config/editcamera/editcamera.component.ts

@ -21,7 +21,7 @@ export class EditcameraComponent implements OnInit {
name: [datacopy.name, [Validators.required]],
user: [datacopy.user, [Validators.required]],
password: [datacopy.password, [Validators.required]],
url: [datacopy.url, [Validators.required]],
uri: [datacopy.uri, [Validators.required]],
type: [datacopy.type, [Validators.required]]
});
}

80
src/app/system-management/host-config/host-config.component.html

@ -1,42 +1,42 @@
<div class="box">
<div class="leftbox">
<nz-page-header class="site-page-header" (nzBack)="goback()" nzBackIcon nzSubtitle="返回上一页"></nz-page-header>
<div class="cameraList">
<div class="title">
<span>摄像头列表</span>
<button nz-button nzType="primary" (click)="addCamera()">新增摄像头</button>
</div>
<nz-table #basicTable [nzData]="listOfData" [nzShowPagination]="false">
<thead>
<tr>
<th>名称</th>
<th>用户名</th>
<th>密码</th>
<th>地址</th>
<th>类型</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let item of basicTable.data">
<td>{{ item.name }}</td>
<td>{{ item.user }}</td>
<td>{{ item.password }}</td>
<td>{{ item.url }}</td>
<td>{{ item.type }}</td>
<td>
<span class="blue" style="margin-right: 12px;" (click)="editCamera(item)">编辑</span>
<span class="red" (click)="deleteCamera(item)">删除</span>
</td>
</tr>
</tbody>
</nz-table>
<div class="footer">
<button nz-button nzType="primary">连接</button>
</div>
</div>
<div class="leftbox">
<nz-page-header class="site-page-header" (nzBack)="goback()" nzBackIcon nzSubtitle="返回上一页"></nz-page-header>
<div class="cameraList">
<div class="title">
<span>摄像头列表</span>
<button nz-button nzType="primary" (click)="addCamera()">新增摄像头</button>
</div>
<nz-table #basicTable [nzData]="listOfData" [nzShowPagination]="false">
<thead>
<tr>
<th>名称</th>
<th>用户名</th>
<th>密码</th>
<th>地址</th>
<th>类型</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let item of basicTable.data">
<td>{{ item.name }}</td>
<td>{{ item.user }}</td>
<td>{{ item.password }}</td>
<td>{{ item.uri }}</td>
<td>{{ item.type | cameraType}}</td>
<td>
<span class="blue" style="margin-right: 12px;" (click)="editCamera(item)">编辑</span>
<span class="red" (click)="deleteCamera(item)">删除</span>
</td>
</tr>
</tbody>
</nz-table>
<div class="footer">
<button nz-button nzType="primary">连接</button>
</div>
</div>
<div class="rightbox">
</div>
</div>
</div>
<div class="rightbox">
</div>
</div>

77
src/app/system-management/host-config/host-config.component.ts

@ -11,7 +11,7 @@ interface Camera {
name: string;
user: string;
password: string;
url: string;
uri: string;
type: number
}
@ -31,22 +31,18 @@ export class HostConfigComponent implements OnInit {
ngOnInit(): void {
this.hostId = this.route.snapshot.queryParams.hostId
this.orId = this.route.snapshot.queryParams.orId
this.getCamera()
}
listOfData: Camera[] = [
{
name: '1',
user: 'John Brown',
password: '32',
url: 'New York No. 1 Lake Park',
type: 0
}
];
listOfData: Camera[] = [];
goback() {
history.go(-1)
}
//摄像头
getCamera() {
this.http.get('/api/Cameras').subscribe((data: any) => {
this.listOfData = data.items
console.log('摄像头列表', data.items)
})
}
addCamera() {
const modal = this.modal.create({
@ -59,20 +55,20 @@ export class HostConfigComponent implements OnInit {
if (instance.validateForm.valid) {
await new Promise(resolve => {
console.log('表单信息', instance.validateForm)
// let body = {
// organizationUnitId: '111',
// ipAdress: instance.validateForm.value.ip,
// code: instance.validateForm.value.code,
// name: instance.validateForm.value.name,
// }
// this.http.post('/api/services/app/Camera/Create', body).subscribe(data => {
// resolve(data)
// this.message.create('success', '创建成功!');
// this.getCamera()
// return true
// }, err => {
// return false
// })
let body = {
name: instance.validateForm.value.name,
user: instance.validateForm.value.user,
password: instance.validateForm.value.password,
uri: instance.validateForm.value.uri,
type: instance.validateForm.value.type,
organizationId: this.orId
}
this.http.post('/api/Cameras', body).subscribe(data => {
resolve(data)
this.message.create('success', '创建成功!');
this.getCamera()
return true
})
})
} else {
this.message.create('warning', '请填写完整!');
@ -96,17 +92,20 @@ export class HostConfigComponent implements OnInit {
if (instance.validateForm.valid) {
await new Promise(resolve => {
console.log('表单信息', instance.validateForm)
// data.name = instance.validateForm.value.name
// data.code = instance.validateForm.value.code
// data.ipAdress = instance.validateForm.value.ip
// this.http.put('/api/services/app/Camera/Update', data).subscribe(data => {
// resolve(data)
// this.message.create('success', '编辑成功!');
// this.getCamera()
// return true
// }, err => {
// return false
// })
let body = {
name: instance.validateForm.value.name,
user: instance.validateForm.value.user,
password: instance.validateForm.value.password,
uri: instance.validateForm.value.uri,
type: instance.validateForm.value.type,
organizationId: this.orId
}
this.http.put(`/api/Cameras/${data.id}`, body).subscribe(data => {
resolve(data)
this.message.create('success', '创建成功!');
this.getCamera()
return true
})
})
} else {
this.message.create('warning', '请填写完整!');
@ -123,11 +122,7 @@ export class HostConfigComponent implements OnInit {
nzOkText: '确定',
nzOkType: 'default',
nzOnOk: () => {
this.http.delete('/api/services/app/Camera/Delete', {
params: {
Id: item.id
}
}).subscribe(data => {
this.http.delete(`/api/Cameras/${item.id}`).subscribe(data => {
this.message.create('success', '删除成功!');
this.getCamera()
})

8
src/app/system-management/system-management.module.ts

@ -29,8 +29,10 @@ import { EditcameraComponent } from './host-config/editcamera/editcamera.compone
import { HostConfigComponent } from './host-config/host-config.component';
import { NzPageHeaderModule } from 'ng-zorro-antd/page-header';
import { PlottingImageComponent } from './plotting-image/plotting-image.component';
import { cameraType } from '../pipe/cameraTypePipe';
@NgModule({
declarations: [OrganizationComponent, NavigationComponent, AddorComponent, EditorComponent, AnalysisOfTheHostComponent, AddhostComponent, EdithostComponent, AddcameraComponent, EditcameraComponent, HostConfigComponent, PlottingImageComponent],
declarations: [OrganizationComponent, NavigationComponent, AddorComponent, EditorComponent, AnalysisOfTheHostComponent, AddhostComponent, EdithostComponent, AddcameraComponent, EditcameraComponent, HostConfigComponent, PlottingImageComponent, cameraType],
imports: [
CommonModule,
SystemRoutingModule,
@ -53,7 +55,7 @@ import { PlottingImageComponent } from './plotting-image/plotting-image.componen
NzCheckboxModule,
NzPageHeaderModule
],
entryComponents :[AddorComponent,EditorComponent,AddhostComponent,EdithostComponent,AddcameraComponent,EditcameraComponent]
entryComponents: [AddorComponent, EditorComponent, AddhostComponent, EdithostComponent, AddcameraComponent, EditcameraComponent]
})
export class SystemManagementModule { }

Loading…
Cancel
Save