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

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

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

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

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

Loading…
Cancel
Save