Commit cd21e8f7 authored by wangqinghua's avatar wangqinghua

commonService

parent 2df735af
import {Component, OnInit} from '@angular/core';
import {OverAllService} from '../../../overAll/overAll.service';
import {NzMessageService, NzTreeNode, NzFormatEmitEvent} from 'ng-zorro-antd';
import {ToTree} from '../../../shared/common/toTree';
import {CommonService} from '../../../shared/common/common.service';
@Component({
selector: 'smart-alarm-target',
......@@ -15,7 +15,7 @@ export class AlarmTargetComponent implements OnInit {
nodes;
constructor(private overAllSer:OverAllService,private message:NzMessageService,
private toTree:ToTree) {
private commonSer:CommonService) {
}
ngOnInit() {
......@@ -40,7 +40,6 @@ export class AlarmTargetComponent implements OnInit {
}
toNode(data){
// const arr = this.toTree.listToTree(1,2,data)
this.nodes = data.map(res=>{
return new NzTreeNode(res);
})
......
......@@ -3,8 +3,7 @@ import {Router} from '@angular/router';
import {Http} from '@angular/http';
import {LayoutService} from '../layout.service';
import {LocalStorageService, SessionStorageService} from 'ngx-webstorage';
import {ToTree} from '../../shared/common/toTree';
import {CommonService} from '../../shared/common/common.service';
@Component({
selector: 'jhi-sidebar',
......@@ -20,7 +19,7 @@ export class SidebarComponent implements OnInit {
constructor(public router: Router, private http: Http,
public layoutSer: LayoutService,
public toTreeSer: ToTree,
public commonSer: CommonService,
private $localStorage: LocalStorageService,
private $sessionStorage: SessionStorageService) {
}
......@@ -35,7 +34,7 @@ export class SidebarComponent implements OnInit {
this.layoutSer.getMenu().subscribe(
(res) => {
if (res.errCode == 10000) {
this.menuList = this.toTreeSer.listToTree('id', 'parentId', res.data);
this.menuList = this.commonSer.listToTree('id', 'parentId', res.data);
}
}
);
......
import {Component, EventEmitter, OnInit, Output} from '@angular/core';
import {NzTreeNode} from 'ng-zorro-antd';
import {SystemService} from '../../system/system.service';
import {ToTree} from '../../shared/common/toTree';
import {CommonService} from '../../shared/common/common.service';
@Component({
selector: 'smart-select-person',
......@@ -23,7 +23,7 @@ export class SelectPersonComponent implements OnInit {
indeterminate = false;
displayData: Array<{ key1: string; key2: number; key3: string; key4: string; checked: boolean }> = [];
constructor(private systemSer: SystemService, private toTreeSer: ToTree) {
constructor(private systemSer: SystemService, private commonSer: CommonService) {
}
checkAll(value: boolean): void {
......@@ -111,7 +111,7 @@ export class SelectPersonComponent implements OnInit {
}
nodeTree() {
const tree = this.toTreeSer.listToTree('id', 'parentId', this.groupList,);
const tree = this.commonSer.listToTree('id', 'parentId', this.groupList,);
const list = tree.map(res => {
return new NzTreeNode(res);
});
......
import {Injectable, OnInit} from "@angular/core";
import {NzModalService} from 'ng-zorro-antd';
@Injectable()
export class ToTree implements OnInit {
export class CommonService implements OnInit {
constructor() {
constructor(private modalSer:NzModalService) {
// 定义发射事件
}
......@@ -62,4 +63,16 @@ export class ToTree implements OnInit {
str = str.substring(0, str.length - 1);
return str;
}
deleteThing(title,callback){
this.modalSer.confirm({
nzTitle: '删除',
nzContent: '<b style="color: red;">title</b>',
nzOkText: '确定',
nzOkType: 'danger',
nzOnOk: callback,
nzCancelText: '取消',
nzOnCancel: () => console.log('Cancel'),
})
}
}
......@@ -3,8 +3,8 @@ import {NzMessageService, NzModalService, NzTreeNode, NzTreeNodeOptions} from 'n
import {SystemService} from '../system.service';
import {UserComponent} from '../modal/user/user.component';
import {GroupModalComponent} from '../modal/group-modal/group-modal.component';
import {ToTree} from '../../shared/common/toTree';
import {SelectRoleComponent} from '../../modal/select-role/select-role.component';
import {CommonService} from '../../shared/common/common.service';
@Component({
selector: 'jhi-group',
......@@ -29,7 +29,7 @@ export class GroupComponent implements OnInit {
displayData: Array<{ key1: string; key2: number; key3: string; key4: string; checked: boolean }> = [];
constructor(private systemSer: SystemService, private message: NzMessageService,
private modalSer: NzModalService, private toTreeSer: ToTree) {
private modalSer: NzModalService, private commonSer: CommonService) {
}
checkAll(value: boolean): void {
......@@ -90,7 +90,7 @@ export class GroupComponent implements OnInit {
}
nodeTree() {
const tree = this.toTreeSer.listToTree('id', 'parentId', this.groupList,);
const tree = this.commonSer.listToTree('id', 'parentId', this.groupList,);
const list = tree.map(res => {
return new NzTreeNode(res);
});
......
......@@ -9,7 +9,7 @@ import {
import {SystemService} from '../../system.service';
import {NzMessageService, NzTreeNode} from 'ng-zorro-antd';
import {LayoutService} from '../../../layouts/layout.service';
import {ToTree} from '../../../shared/common/toTree';
import {CommonService} from '../../../shared/common/common.service';
@Component({
selector: 'smart-role',
......@@ -28,7 +28,7 @@ export class RoleComponent implements OnInit {
nodeList;
constructor(private fb: FormBuilder, private message: NzMessageService,
private systemSer: SystemService,private layoutSer:LayoutService,private toTreeSer:ToTree) {
private systemSer: SystemService,private layoutSer:LayoutService,private commonSer:CommonService) {
}
ngOnInit() {
......@@ -49,7 +49,7 @@ export class RoleComponent implements OnInit {
this.layoutSer.getMenu().subscribe(
(res)=>{
if(res.errCode == 10000){
this.menuList =this.toTreeSer.listToTree('id','parentId',res.data);
this.menuList =this.commonSer.listToTree('id','parentId',res.data);
this.menuList.forEach(res => {
res.title = res.name;
res.key = res.id;
......
......@@ -2,12 +2,12 @@ import { HttpClient } from "@angular/common/http";
import {Observable} from "rxjs/Rx";
import { Injectable } from '@angular/core';
import {SERVER_API_URL} from "../app.constants";
import {ToTree} from '../shared/common/toTree';
import {CommonService} from '../shared/common/common.service';
@Injectable()
export class SystemService {
constructor(private http: HttpClient,private toTree:ToTree) {
constructor(private http: HttpClient,private commonSer:CommonService) {
}
//角色列表
......@@ -67,7 +67,7 @@ export class SystemService {
//审计列表
logList(data): Observable<any>{
return this.http.get(SERVER_API_URL + '/log?'+this.toTree.toQuery(data));
return this.http.get(SERVER_API_URL + '/log?'+this.commonSer.toQuery(data));
}
//对单一角色批量添加用户
......@@ -97,27 +97,27 @@ export class SystemService {
//单个用户角色获取
roleList(data): Observable<any>{
return this.http.get(SERVER_API_URL + '/user/roleList?'+this.toTree.toQuery(data) );
return this.http.get(SERVER_API_URL + '/user/roleList?'+this.commonSer.toQuery(data) );
}
//获取当前安全管理员已审批记录
approveListSafeManager(data): Observable<any>{
return this.http.get(SERVER_API_URL + '/approval/approveListSafeManager?'+this.toTree.toQuery(data) );
return this.http.get(SERVER_API_URL + '/approval/approveListSafeManager?'+this.commonSer.toQuery(data) );
}
//获取当前安全管理员未审批记录
unapproveListSafeManager(data): Observable<any>{
return this.http.get(SERVER_API_URL + '/approval/unapproveListSafeManager?'+this.toTree.toQuery(data) );
return this.http.get(SERVER_API_URL + '/approval/unapproveListSafeManager?'+this.commonSer.toQuery(data) );
}
//获取当前系统管理员的已审批记录
approveListSystemManager(data): Observable<any>{
return this.http.get(SERVER_API_URL + '/approval/approveListSystemManager?'+this.toTree.toQuery(data) );
return this.http.get(SERVER_API_URL + '/approval/approveListSystemManager?'+this.commonSer.toQuery(data) );
}
//获取当前系统管理员的未审批记录
unApproveListSystemManager(data): Observable<any>{
return this.http.get(SERVER_API_URL + '/approval/unApproveListSystemManager?'+this.toTree.toQuery(data) );
return this.http.get(SERVER_API_URL + '/approval/unApproveListSystemManager?'+this.commonSer.toQuery(data) );
}
//批量审批通过
......
......@@ -57,8 +57,9 @@
{{data.name}}
</td>
<td>
{{data.inventorycount}}
{{data.name}}
</td>
<td>{{data.inventorycount}}</td>
<td>{{data.stock}}</td>
<td>
{{data.usedcount}}
......@@ -73,7 +74,7 @@
<td>关联事件</td>
<td class="handle text-center">
<span (click)="showEditModal(data)">查看</span>
<span (click)="deleteSend(data)">删除</span>
<span (click)="deleteInVentory(data)">删除</span>
</td>
</tr>
</tbody>
......
import { Component, OnInit } from '@angular/core';
import {Component, OnInit} from '@angular/core';
import {WorkService} from '../../work.service';
import {ActivatedRoute, Router} from '@angular/router';
import {CommonService} from '../../../shared/common/common.service';
@Component({
selector: 'smart-child-assets',
templateUrl: './child-assets.component.html',
styles: []
selector: 'smart-child-assets',
templateUrl: './child-assets.component.html',
styles: []
})
export class ChildAssetsComponent implements OnInit {
childId;
childId;
childrenList;
constructor(private workSer:WorkService,private routerInfo:ActivatedRoute) {
this.routerInfo.queryParams.subscribe(
(res)=>{
this.childId = res.id;
}
)
}
constructor(private workSer: WorkService, private routerInfo: ActivatedRoute,
private conmonSer:CommonService) {
this.routerInfo.queryParams.subscribe(
(res) => {
this.childId = res.id;
}
);
}
ngOnInit() {
this.getList();
}
ngOnInit() {
this.getList();
}
getList() {
this.workSer.findInventory(this.childId).subscribe(
(res) => {
this.childrenList = res.data;
}
);
}
getList(){
// this.workSer.create()
//删除资产
deleteInVentory(){
this.conmonSer.deleteThing("确定删除该资产?",()=>{
// this.workSer.
})
}
}
......@@ -119,5 +119,9 @@ export class WorkService {
return this.http.post(SERVER_API_URL + '/inventory/createInventory' ,data);
}
//
//根据资产类型id查询资产
findInventory(params): Observable<any>{
return this.http.get(SERVER_API_URL + '/inventory/findInventory/' +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