Commit f378c4a2 authored by wangqinghua's avatar wangqinghua

commonService

parent 15fe5653
......@@ -81,6 +81,7 @@ import {TypeAsetsComponent} from './work/modal/type-asets/type-asets.component';
import {AssetsDetailComponent} from './work/asset-part/assets-detail/assets-detail.component';
import {AssetsComponent} from './work/modal/assets/assets.component';
import {ChildAssetsComponent} from './work/asset-part/child-assets/child-assets.component';
import {UploadComponent} from './work/modal/upload/upload.component';
@NgModule({
imports: [
......@@ -162,6 +163,7 @@ import {ChildAssetsComponent} from './work/asset-part/child-assets/child-assets.
AssetsDetailComponent,
AssetsComponent,
ChildAssetsComponent,
UploadComponent,
],
providers:[
OverAllService,
......
......@@ -56,7 +56,7 @@ export const route: Routes = [
{path: 'inspectPlan', component: InspectPlanComponent},
{path: 'assetPart', component: AssetPartComponent},
{path: 'assetChild', component: ChildAssetsComponent},
{path: 'assetDetail', component: AssetsDetailComponent},
{path: 'assetsDetail', component: AssetsDetailComponent},
]
},
]
......
......@@ -27,14 +27,14 @@
</nz-select>
</div>
<div nz-col nzSpan="3">
<button nz-button nzType="default"><i class="anticon anticon-plus"></i>导入资产</button>
<button (click)="showUploadModal()" nz-button nzType="default"><i class="anticon anticon-plus"></i>导入资产</button>
</div>
<div nz-col nzSpan="3">
<button nz-button nzType="default"><i class="anticon anticon-plus"></i>下载</button>
</div>
<div nz-col nzSpan="6">
<button (click)="showAddModal()" nz-button nzType="default"><i class="anticon anticon-plus"></i>添加</button>
<button (click)="showAEditModal()" nz-button nzType="default"><i class="anticon anticon-plus"></i>编辑</button>
<button (click)="showPEditModal()" nz-button nzType="default"><i class="anticon anticon-plus"></i>编辑</button>
<button nz-button nzType="default"><i class="anticon anticon-plus"></i>删除</button>
</div>
</div>
......@@ -56,7 +56,7 @@
<tbody>
<tr *ngFor="let data of childrenList">
<td class="round-tag tag-form">
{{data.name}}
<span (click)="showCEditModal(data.id)">{{data.name}}</span>
</td>
<td>
{{data.inventorycount}}
......@@ -83,4 +83,6 @@
</nz-table>
<!--新增分类-->
<smart-type-asets #smartTypeAsets (done)="getList()"></smart-type-asets>
\ No newline at end of file
<smart-type-asets #smartTypeAsets (done)="getList()"></smart-type-asets>
<!--倒入资产-->
<smart-upload #smartUpload></smart-upload>
\ No newline at end of file
......@@ -4,6 +4,7 @@ import {pageSize} from '../../app.constants';
import {Router} from '@angular/router';
import {TypeAsetsComponent} from '../modal/type-asets/type-asets.component';
import {NzMessageService} from 'ng-zorro-antd';
import {UploadComponent} from '../modal/upload/upload.component';
@Component({
selector: 'smart-asset-part',
......@@ -12,6 +13,7 @@ import {NzMessageService} from 'ng-zorro-antd';
})
export class AssetPartComponent implements OnInit {
@ViewChild('smartTypeAsets') smartTypeAsets:TypeAsetsComponent;
@ViewChild('smartUpload') smartUpload:UploadComponent;
timeFormat = 'yyyy-MM-dd';
parentList;
......@@ -77,8 +79,18 @@ export class AssetPartComponent implements OnInit {
this.smartTypeAsets.showAddModal("新增分类");
}
showAEditModal(){
this.smartTypeAsets.showEditModal("编辑分类");
//编辑父级分类
showPEditModal(){
this.smartTypeAsets.showEditModal("编辑分类",this.obj.type);
}
//编辑子级分类
showCEditModal(id){
this.smartTypeAsets.showEditModal("编辑分类",id);
}
//导入资产
showUploadModal(){
this.smartUpload.showModal();
}
}
......@@ -28,13 +28,35 @@
<nz-tabset class="tabs-smart ">
<nz-tab #thirdTabs nzTitle="资产信息" >
<div nz-form class="ant-advanced-search-form form-select">
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="12">
<nz-form-item nzFlex>
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired nzFor="equipmentTypeid">资产编号
</nz-form-label>
<nz-form-control [nzSpan]="14">
{{inventoryExtend?.name}}
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzSpan]="12">
<nz-form-item nzFlex>
<nz-form-label [nzSpan]="6">负责人</nz-form-label>
<nz-form-control [nzSpan]="14">
{{inventoryExtend?.person}}
</nz-form-control>
</nz-form-item>
</div>
</div>
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="12">
<nz-form-item nzFlex>
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired nzFor="equipmentTypeid">资产名称
</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input placeholder="资产名称" name="name" [(ngModel)]="validateForm.inventoryExtend.name">
{{inventoryExtend?.name}}
</nz-form-control>
</nz-form-item>
</div>
......@@ -43,7 +65,7 @@
<nz-form-item nzFlex>
<nz-form-label [nzSpan]="6">负责人</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input placeholder="负责人" name="person" [(ngModel)]="validateForm.inventoryExtend.person">
{{inventoryExtend?.person}}
</nz-form-control>
</nz-form-item>
</div>
......@@ -55,7 +77,7 @@
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired nzFor="secondLevelType">资产数量
</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input placeholder="资产数量" name="inventorycount" [(ngModel)]="validateForm.inventoryExtend.inventorycount">
{{inventoryExtend?.inventorycount}}
</nz-form-control>
</nz-form-item>
</div>
......@@ -64,7 +86,7 @@
<nz-form-item nzFlex>
<nz-form-label [nzSpan]="6" nzFor="invertoryname">品牌</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input placeholder="品牌" name="invertoryname" [(ngModel)]="validateForm.inventoryExtend.invertoryname">
{{inventoryExtend?.invertoryname}}
</nz-form-control>
</nz-form-item>
</div>
......@@ -75,7 +97,7 @@
<nz-form-item nzFlex>
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired >库存</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input placeholder="库存" name="stock" [(ngModel)]="validateForm.inventoryExtend.stock">
{{inventoryExtend?.stock}}
</nz-form-control>
</nz-form-item>
</div>
......@@ -84,7 +106,7 @@
<nz-form-item nzFlex>
<nz-form-label [nzSpan]="6" >型号</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input placeholder="型号" name="serialnoA" [(ngModel)]="validateForm.inventoryExtend.serialnoA">
{{inventoryExtend?.serialnoA}}
</nz-form-control>
</nz-form-item>
</div>
......@@ -95,7 +117,7 @@
<nz-form-item nzFlex>
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired>使用</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input placeholder="使用" name="usedcount" [(ngModel)]="validateForm.inventoryExtend.usedcount">
{{inventoryExtend?.usedcount}}
</nz-form-control>
</nz-form-item>
</div>
......@@ -104,7 +126,7 @@
<nz-form-item nzFlex>
<nz-form-label [nzSpan]="6" >MAC地址</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input placeholder="MAC地址" name="mac" [(ngModel)]="validateForm.inventoryExtend.mac">
{{inventoryExtend?.mac}}
</nz-form-control>
</nz-form-item>
</div>
......@@ -114,7 +136,7 @@
<nz-form-item nzFlex>
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired >借出</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input placeholder="借出" name="lendcount" [(ngModel)]="validateForm.inventoryExtend.lendcount">
{{inventoryExtend?.lendcount}}
</nz-form-control>
</nz-form-item>
</div>
......@@ -123,7 +145,7 @@
<nz-form-item nzFlex>
<nz-form-label [nzSpan]="6">维保到期</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input placeholder="维保到期" name="maintenanceExpiration" [(ngModel)]="validateForm.inventoryExtend.maintenanceExpiration" >
{{inventoryExtend?.maintenanceExpiration}}
</nz-form-control>
</nz-form-item>
</div>
......@@ -134,7 +156,7 @@
<nz-form-item nzFlex>
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired>维修</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input placeholder="维修" name="repaircount" [(ngModel)]="validateForm.inventoryExtend.repaircount">
{{inventoryExtend?.repaircount}}
</nz-form-control>
</nz-form-item>
</div>
......@@ -143,7 +165,7 @@
<nz-form-item nzFlex>
<nz-form-label [nzSpan]="6">存放地点</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input placeholder="存放地点" name="storageLocation" [(ngModel)]="validateForm.inventoryExtend.storageLocation">
{{inventoryExtend?.storageLocation}}
</nz-form-control>
</nz-form-item>
</div>
......@@ -154,7 +176,8 @@
<nz-form-item nzFlex>
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired >报废</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input placeholder="报废" name="scrapcount" [(ngModel)]="validateForm.inventoryExtend.scrapcount">
{{inventoryExtend?.scrapcount}}
<!--<input nz-input placeholder="报废" name="scrapcount" [(ngModel)]="inventoryExtend?.scrapcount">-->
</nz-form-control>
</nz-form-item>
</div>
......@@ -165,11 +188,6 @@
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired >父分类
</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-select name="secondLevelType" nzPlaceHolder="选择父分类" (nzListOfSelectedValueChange)="getTypeByParent($event)">
<ng-container *ngFor="let item of parentTypeList">
<nz-option [nzLabel]="item.name" [nzValue]="item.id"></nz-option>
</ng-container>
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
......@@ -181,11 +199,6 @@
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired >子分类
</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-select name="secondLevelType" nzPlaceHolder="选择子分类" [(ngModel)]="validateForm.inventoryExtend.inventoryTypeid">
<ng-container *ngFor="let item of typeList">
<nz-option [nzLabel]="item.name" [nzValue]="item.id"></nz-option>
</ng-container>
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
......
import { Component, OnInit } from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {WorkService} from '../../work.service';
@Component({
selector: 'smart-assets-detail',
......@@ -7,9 +9,26 @@ import { Component, OnInit } from '@angular/core';
})
export class AssetsDetailComponent implements OnInit {
constructor() { }
invertoryId;
inventoryExtend;
constructor(private routerInfo:ActivatedRoute,private workSer:WorkService) {
this.routerInfo.queryParams.subscribe(
(res)=>{
this.invertoryId = res.invertoryId;
}
)
}
ngOnInit() {
this.getDetail();
}
getDetail(){
this.workSer.selectByPrimaryKey(this.invertoryId).subscribe(
(res)=>{
this.inventoryExtend = res.data;
}
)
}
}
......@@ -73,7 +73,7 @@
</td>
<td>关联事件</td>
<td class="handle text-center">
<span (click)="showEditModal(data)">查看</span>
<span (click)="goToDetail(data)">查看</span>
<span (click)="deleteInVentory(data)">删除</span>
</td>
</tr>
......
......@@ -16,7 +16,7 @@ export class ChildAssetsComponent implements OnInit {
childId;
childrenList;
constructor(private workSer: WorkService, private routerInfo: ActivatedRoute,
constructor(private workSer: WorkService, private routerInfo: ActivatedRoute,private router:Router,
private conmonSer:CommonService,private message:NzMessageService) {
this.routerInfo.queryParams.subscribe(
(res) => {
......@@ -62,8 +62,18 @@ export class ChildAssetsComponent implements OnInit {
this.smartAssets.showAddModal("添加资产");
}
showEditModal(){
//编辑资产
showEditModal(id){
this.smartAssets.showEditModal("编辑资产");
}
//查看详情
goToDetail(data){
this.router.navigate(['app/main/assetsDetail'],{
queryParams:{
invertoryId:data.id
}
})
}
}
import {Component, EventEmitter, OnInit, Output} from '@angular/core';
import {timeEnd} from '@ngtools/webpack/src/benchmark';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import {FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms';
import {WorkService} from '../../work.service';
import {NzMessageService} from 'ng-zorro-antd';
......@@ -18,6 +18,8 @@ export class TypeAsetsComponent implements OnInit {
isChildren = false;
validateForm:FormGroup;
updateId;
constructor(private fb:FormBuilder,private workSer:WorkService,
private message:NzMessageService) {
}
......@@ -50,6 +52,7 @@ export class TypeAsetsComponent implements OnInit {
}
initForm(){
this.isChildren = false;
this.validateForm = this.fb.group(
{
parentid:[null],
......@@ -66,13 +69,17 @@ export class TypeAsetsComponent implements OnInit {
this.getParentList();
}
showEditModal(title) {
showEditModal(title,id) {
this.isVisible = true;
this.title = title;
this.getParentList();
this.workSer.findType("").subscribe(
this.updateId=id;
this.workSer.findType(id).subscribe(
(res)=>{
if(res.data.parentid){
this.isChildren = true;
}
this.validateForm.patchValue(res.data);
}
)
}
......@@ -92,7 +99,7 @@ export class TypeAsetsComponent implements OnInit {
if(this.title == "新增分类"){
this.create();
}
if(this.title == "编辑分类分类"){
if(this.title == "编辑分类"){
this.update();
}
}
......@@ -113,6 +120,18 @@ export class TypeAsetsComponent implements OnInit {
}
update(){
this.validateForm.addControl("id",new FormControl(this.updateId));
this.workSer.updateType(this.validateForm.value).subscribe(
(res)=>{
if(res.errCode == 10000){
this.isVisible = false;
this.done.emit();
this.initForm();
this.message.success("修改分类成功");
}else{
this.message.error(res.errMsg);
}
}
)
}
}
......@@ -96,7 +96,7 @@ export class WorkService {
//根据主键id查询资产类型
findType(params): Observable<any>{
return this.http.get(SERVER_API_URL + '/inventory/findType/' ,params);
return this.http.get(SERVER_API_URL + '/inventory/findType/' +params);
}
//根据资产类型id 查询没有配置主机的资产
......@@ -129,4 +129,13 @@ export class WorkService {
return this.http.post(SERVER_API_URL + '/inventory/deleteInventory' ,data);
}
//导入资产
importInventory(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/inventory/import' ,data);
}
//根据资产类型id查询资产
selectByPrimaryKey(params): Observable<any>{
return this.http.get(SERVER_API_URL + '/inventory/selectByPrimaryKey/' +params);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment