Commit d605ece0 authored by wangqinghua's avatar wangqinghua

commonService

parent eb3e6c9f
......@@ -67,7 +67,7 @@ export class CommonService implements OnInit {
deleteThing(title,callback){
this.modalSer.confirm({
nzTitle: '删除',
nzContent: '<b style="color: red;">title</b>',
nzContent: '<b style="color: red;">'+title+'</b>',
nzOkText: '确定',
nzOkType: 'danger',
nzOnOk: callback,
......
......@@ -28,7 +28,16 @@ export class ExamineComponent implements OnInit {
}
getList() {
this.systemSer.approveList().subscribe(
(res)=>{
}
)
this.systemSer.unApproveList().subscribe(
(res)=>{
}
)
}
}
......@@ -134,4 +134,12 @@ export class SystemService {
approvalRemove(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/approval/remove', data);
}
approveList(): Observable<any>{
return this.http.get(SERVER_API_URL + '/approval/approveList');
}
unApproveList(): Observable<any>{
return this.http.get(SERVER_API_URL + '/approval/unApproveList' );
}
}
......@@ -82,4 +82,5 @@
</tbody>
</nz-table>
<smart-type-asets #smartTypeAsets></smart-type-asets>
\ No newline at end of file
<!--新增分类-->
<smart-type-asets #smartTypeAsets (done)="getList()"></smart-type-asets>
\ No newline at end of file
......@@ -3,6 +3,7 @@ import {WorkService} from '../work.service';
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';
@Component({
selector: 'smart-asset-part',
......@@ -31,7 +32,8 @@ export class AssetPartComponent implements OnInit {
startTime:'',
endTime:'',
};
constructor(private workSer:WorkService,private router:Router) { }
constructor(private workSer:WorkService,private router:Router,
private messge:NzMessageService) { }
ngOnInit() {
this.getList();
......@@ -43,7 +45,7 @@ export class AssetPartComponent implements OnInit {
if(res.errCode == 10000){
this.parentList = res.data;
}else{
this.messge.error(res.errMsg);
}
}
)
......
......@@ -23,7 +23,7 @@
</div>
<div nz-row [nzGutter]="4" class="search-form">
<div nz-col nzSpan="3">
<button nz-button nzType="default"><i class="anticon anticon-plus"></i>添加资产</button>
<button (click)="showAddModal()" 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>
......@@ -79,3 +79,6 @@
</tr>
</tbody>
</nz-table>
<!--新增资产-->
<smart-assets #smartAssets (done)="getList()"></smart-assets>
\ No newline at end of file
import {Component, OnInit} from '@angular/core';
import {Component, OnInit, ViewChild} from '@angular/core';
import {WorkService} from '../../work.service';
import {ActivatedRoute, Router} from '@angular/router';
import {CommonService} from '../../../shared/common/common.service';
import {NzMessageService} from 'ng-zorro-antd';
import {AssetsComponent} from '../../modal/assets/assets.component';
@Component({
selector: 'smart-child-assets',
......@@ -9,12 +11,13 @@ import {CommonService} from '../../../shared/common/common.service';
styles: []
})
export class ChildAssetsComponent implements OnInit {
@ViewChild('smartAssets') smartAssets:AssetsComponent;
childId;
childrenList;
constructor(private workSer: WorkService, private routerInfo: ActivatedRoute,
private conmonSer:CommonService) {
private conmonSer:CommonService,private message:NzMessageService) {
this.routerInfo.queryParams.subscribe(
(res) => {
this.childId = res.id;
......@@ -35,10 +38,32 @@ export class ChildAssetsComponent implements OnInit {
}
//删除资产
deleteInVentory(){
deleteInVentory(item){
const data = {
inventoryIds:[]
};
data.inventoryIds.push(item.id);
this.conmonSer.deleteThing("确定删除该资产?",()=>{
// this.workSer.
this.workSer.deleteInventory(data).subscribe(
(res)=>{
if(res.errCode == 10000){
this.getList();
this.message.success("删除资产成功");
}else{
this.message.error(res.errMsg);
}
}
)
})
}
//添加资产
showAddModal() {
this.smartAssets.showAddModal("添加资产");
}
showEditModal(){
this.smartAssets.showEditModal("编辑资产");
}
}
<nz-modal [nzWidth]="1080" [nzFooter]="null" [(nzVisible)]="isBasicEdit" nzTitle="{{modalTitle}}"
(nzOnCancel)="handleEditCancel()" (nzOnOk)="handEditleOk()">
<nz-modal [nzWidth]="1080" [(nzVisible)]="isVisible" nzTitle="{{title}}" (nzOnCancel)="handleEditCancel()" (nzOnOk)="handEditleOk()">
<form nz-form [formGroup]="validateForm">
<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 [nzOffset]="4" [nzSpan]="6" nzRequired nzFor="name">资产名称
</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input placeholder="资产名称" name="name" formControlName="name">
......@@ -27,7 +26,7 @@
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="12">
<nz-form-item nzFlex>
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired nzFor="secondLevelType">资产数量
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzFor="secondLevelType">资产数量
</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input placeholder="资产数量" name="inventorycount"
......@@ -50,7 +49,7 @@
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="12">
<nz-form-item nzFlex>
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired>库存</nz-form-label>
<nz-form-label [nzOffset]="4" [nzSpan]="6">库存</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input placeholder="库存" name="stock" formControlName="stock">
</nz-form-control>
......@@ -71,7 +70,7 @@
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="12">
<nz-form-item nzFlex>
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired>使用</nz-form-label>
<nz-form-label [nzOffset]="4" [nzSpan]="6">使用</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input placeholder="使用" name="usedcount"
formControlName="usedcount">
......@@ -91,7 +90,7 @@
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="12">
<nz-form-item nzFlex>
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired>借出</nz-form-label>
<nz-form-label [nzOffset]="4" [nzSpan]="6">借出</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input placeholder="借出" name="lendcount"
formControlName="lendcount">
......@@ -113,7 +112,7 @@
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="12">
<nz-form-item nzFlex>
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired>维修</nz-form-label>
<nz-form-label [nzOffset]="4" [nzSpan]="6">维修</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input placeholder="维修" name="repaircount"
formControlName="repaircount">
......@@ -135,7 +134,7 @@
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="12">
<nz-form-item nzFlex>
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired>报废</nz-form-label>
<nz-form-label [nzOffset]="4" [nzSpan]="6">报废</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input placeholder="报废" name="scrapcount"
formControlName="scrapcount">
......@@ -146,11 +145,10 @@
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="12">
<nz-form-item nzFlex>
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired>父分类
<nz-form-label [nzOffset]="4" [nzSpan]="6">父分类
</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-select name="secondLevelType" nzPlaceHolder="选择父分类"
(nzListOfSelectedValueChange)="getTypeByParent($event)">
<nz-select name="secondLevelType" nzPlaceHolder="选择父分类" [ngModelOptions]="{standalone: true}" [(ngModel)]="parentId" (ngModelChange)="getTypeByParent($event)">
<ng-container *ngFor="let item of parentTypeList">
<nz-option [nzLabel]="item.name" [nzValue]="item.id"></nz-option>
</ng-container>
......
import {Component, OnInit} from '@angular/core';
import {FormBuilder, FormGroup} from '@angular/forms';
import {Component, EventEmitter, OnInit, Output} from '@angular/core';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import {WorkService} from '../../work.service';
import {NzMessageService} from 'ng-zorro-antd';
@Component({
selector: 'smart-assets',
......@@ -8,15 +9,18 @@ import {WorkService} from '../../work.service';
styles: []
})
export class AssetsComponent implements OnInit {
@Output() done = new EventEmitter<any>();
isVisible = false;
title;
parentId;
validateForm:FormGroup;
parentTypeList;
typeList;
constructor(private workSer:WorkService,private fb:FormBuilder) {
constructor(private workSer:WorkService,private fb:FormBuilder,
private message:NzMessageService) {
}
ngOnInit() {
......@@ -27,7 +31,7 @@ export class AssetsComponent implements OnInit {
this.validateForm = this.fb.group({
serialnoA:[null],
invertoryname:[null],
name:[null],
name:[null,[Validators.required]],
hostid:[null],
person:[null],
ip:[null],
......@@ -43,7 +47,7 @@ export class AssetsComponent implements OnInit {
scrapcount:[null],
storageLocation:[null],
groupid:[null],
inventoryTypeid:[null],
inventoryTypeid:[null,[Validators.required]],
});
}
......@@ -87,10 +91,10 @@ export class AssetsComponent implements OnInit {
if(this.validateForm.invalid){
return false;
}
if(this.title == ""){
if(this.title == "添加资产"){
this.create();
}
if(this.title == ""){
if(this.title == "编辑资产"){
this.update();
}
}
......@@ -98,7 +102,13 @@ export class AssetsComponent implements OnInit {
create(){
this.workSer.createInventory(this.validateForm.value).subscribe(
(res)=>{
if(res.errCode == 10000){
this.message.success("添加资产成功");
this.isVisible = false;
this.done.emit();
}else{
this.message.error(res.errMsg);
}
}
)
}
......
<nz-modal [(nzVisible)]="isVisible" nzTitle="{{title}}" (nzOnCancel)="handleCancel()" (nzOnOk)="handleOk()">
<form nz-form [formGroup]="validateForm">
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="name">分类类型</nz-form-label>
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="name">分类类型</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24">
<nz-tag nzMode="checkable" [nzChecked]="true" (nzCheckedChange)="checkChange($event)">父分类</nz-tag>
<nz-tag nzMode="checkable" [nzChecked]="true" (nzCheckedChange)="checkChange($event)">子分类</nz-tag>
<nz-tag nzMode="checkable" [nzChecked]="!isChildren" (nzCheckedChange)="checkChange('parent')">父分类</nz-tag>
<nz-tag nzMode="checkable" [nzChecked]="isChildren" (nzCheckedChange)="checkChange('children')">子分类</nz-tag>
</nz-form-control>
</nz-form-item>
<nz-form-item *ngIf="isChildren">
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="status" nzRequired nzFor="parentid">选择父分类</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24">
<nz-select style="width: 100%;" formControlName="parentid" name="parentid" id="parentid" nzPlaceHolder="选择父分类" (ngModelChange)="changeType($event)">
<ng-container *ngFor="let item of parentList">
<nz-option [nzLabel]="item.name" [nzValue]="item.id"></nz-option>
</ng-container>
</nz-select>
<nz-form-explain *ngIf="validateForm.get('parentid').dirty && validateForm.get('parentid').errors">请选择父分类!</nz-form-explain>
</nz-form-control>
</nz-form-item>
<nz-form-item>
......@@ -15,14 +26,14 @@
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="status" nzRequired nzFor="status">分类编号</nz-form-label>
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="status" nzRequired nzFor="typeno">分类编号</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24">
<input type="text" nz-input formControlName="name" name="typeno" id="typeno">
<input type="text" nz-input formControlName="typeno" name="typeno" id="typeno">
<nz-form-explain *ngIf="validateForm.get('typeno').dirty && validateForm.get('typeno').errors">请选择分类编号!</nz-form-explain>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="tyoeDescribe">分类描述</nz-form-label>
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="tyoeDescribe">分类描述</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24">
<textarea id="tyoeDescribe" row="4" nz-input formControlName="tyoeDescribe"></textarea>
<nz-form-explain *ngIf="validateForm.get('tyoeDescribe').dirty && validateForm.get('tyoeDescribe').errors">请输入分类描述!</nz-form-explain>
......
import {Component, OnInit} from '@angular/core';
import {Component, EventEmitter, OnInit, Output} from '@angular/core';
import {timeEnd} from '@ngtools/webpack/src/benchmark';
import {FormBuilder, FormGroup} from '@angular/forms';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import {WorkService} from '../../work.service';
import {NzMessageService} from 'ng-zorro-antd';
@Component({
selector: 'smart-type-asets',
......@@ -8,28 +10,51 @@ import {FormBuilder, FormGroup} from '@angular/forms';
styles: []
})
export class TypeAsetsComponent implements OnInit {
@Output() done = new EventEmitter<any>();
title;
isVisible;
parentList;
isChildren = false;
validateForm:FormGroup;
constructor(private fb:FormBuilder) {
constructor(private fb:FormBuilder,private workSer:WorkService,
private message:NzMessageService) {
}
checkChange(){
checkChange(e){
if(e == 'parent'){
this.isChildren = false;
this.validateForm.get("parentid").clearValidators();
}
if(e == "children"){
this.isChildren = true;
this.validateForm.get('parentid').setValidators(Validators.required);
}
}
ngOnInit() {
this.initForm();
}
getParentList(){
this.workSer.findByParentType().subscribe(
(res)=>{
if(res.errCode == 10000){
this.parentList = res.data;
}else{
this.message.error(res.errMsg);
}
}
)
}
initForm(){
this.validateForm = this.fb.group(
{
parentid:[null],
name:[null],
typeno:[null],
name:[null,[Validators.required]],
typeno:[null,[Validators.required]],
tyoeDescribe:[null],
}
)
......@@ -38,14 +63,25 @@ export class TypeAsetsComponent implements OnInit {
showAddModal(title) {
this.isVisible = true;
this.title = title;
this.getParentList();
}
showEditModal(title) {
this.isVisible = true;
this.title = title;
this.getParentList();
this.workSer.findType("").subscribe(
(res)=>{
}
)
}
handleCancel() {
this.isVisible = false;
}
handleOk() {
for(let i in this.validateForm.controls){
this.validateForm.controls[i].markAsDirty();
this.validateForm.controls[i].updateValueAndValidity();
......@@ -53,9 +89,30 @@ export class TypeAsetsComponent implements OnInit {
if(this.validateForm.invalid){
return false;
}
if(this.title == "新增分类"){
this.create();
}
if(this.title == "编辑分类分类"){
this.update();
}
}
handleOk() {
create(){
this.workSer.createType(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);
}
}
)
}
update(){
}
}
......@@ -124,4 +124,9 @@ export class WorkService {
return this.http.get(SERVER_API_URL + '/inventory/findInventory/' +params);
}
//删除资产(可批量)
deleteInventory(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/inventory/deleteInventory' ,data);
}
}
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