From 4c9cd5da29ffbd2788c47130416fc8780b941103 Mon Sep 17 00:00:00 2001
From: xufenglei <xufenglei>
Date: Mon, 29 Jan 2018 08:59:09 +0800
Subject: [PATCH] echarts
---
src/app/routes/systems/organization/organization.component.ts | 213 +----------------------------------------------------
1 files changed, 4 insertions(+), 209 deletions(-)
diff --git a/src/app/routes/systems/organization/organization.component.ts b/src/app/routes/systems/organization/organization.component.ts
index ef58ac4..474aac0 100644
--- a/src/app/routes/systems/organization/organization.component.ts
+++ b/src/app/routes/systems/organization/organization.component.ts
@@ -1,36 +1,7 @@
-import { DataType, AreaNames } from './../../../core/entity/grid';
-import { Version, ValueTransformer } from '@angular/compiler/src/util';
-import { Subject } from 'rxjs/Subject';
-import { ToolsService } from '@core/services/tools.service';
+import { OrganizationService } from '@business/services/http/organization.service';
import { Component, OnInit } from '@angular/core';
-import { NzMessageService, NzModalService } from 'ng-zorro-antd';
-import { ModalHelper } from '@delon/theme';
-import { HttpClient } from '@angular/common/http';
-import { environment } from '../../../../environments/environment';
-import { DateService } from '@core/services/date.service';
-import { VersionService } from 'app/routes/devices/version/version.service';
-import { Types } from '@core/enum/types.enum';
-import { Column, Grid, PageBean } from '@core/entity/grid';
-import { filter } from 'rxjs/operators/filter';
-import { OrganizationEditComponent } from './organization-edit/organization-edit.component';
-import { OrganizationService } from 'app/routes/systems/organization/organization.service';
-export interface Organization {
- address?: Column|any;
- areaCode?: Column|any;
- cityCode?: Column|any;
- createTime?: Column|any;
- description?: Column|any;
- email?: Column|any;
- expireTime?: Column|any;
- id?: Column|any;
- isDelete?: Column|any;
- name?: Column|any;
- provinceCode?: Column|any;
- rank?: Column|any;
- telephone?: Column|any;
- areaNames?: AreaNames|any ;
-}
+
@Component({
selector: 'app-organization',
@@ -38,185 +9,9 @@
styles: []
})
export class OrganizationComponent implements OnInit {
-
- private organization: Organization;
- grid: Grid<Organization> = new Grid(null);
- queryMap = { text: '���������������', value: ''};
- queryTextStream: Subject<string> = new Subject<string>();
- private initPage() {
- this.organization = {
- name: {
- text: '������',
- width: '120px'
- },
- rank: {
- text: '������',
- width: '60px'
- },
- telephone: {
- text: '������',
- width: '180px'
- },
- address: {
- text: '������',
- width: '300px',
- format: (value: any, col: Column, row: any) => {
- value = value == null ? '' : value ;
- if (row['areaNames'] != null) {
- return row['areaNames']['provinceName'] + row['areaNames']['cityName'] + row['areaNames']['areaName'] + value;
- } else {
- return value;
- }
-
- }
- },
- createTime: {
- text: '������������',
- width: '100px',
- type: {
- name: Types.Date,
- format: 'YYYY-MM-DD HH:mm:ss'
- },
- isSort: true
- },
- expireTime: {
- text: '������������',
- width: '100px',
- type: {
- name: Types.Date,
- format: 'YYYY-MM-DD HH:mm:ss'
- },
- isSort: true
- }
- };
- this.grid.title = '������������';
- this.grid.setColumns(this.organization);
- this.grid.pageSize = 10;
+ ngOnInit(): void {
}
constructor(
- private organizationService: OrganizationService,
-
- private confirmServ: NzModalService,
- public msgSrv: NzMessageService,
- private modalHelper: ModalHelper,
+ private organizationService: OrganizationService
) {}
-
- ngOnInit() {
- this.initPage();
- this.queryTextStream
- .debounceTime(500)
- .distinctUntilChanged()
- .subscribe(queryText => {
- this.load();
- });
- }
- queryTextChanged($event) {
- this.queryTextStream.next(this.queryMap.value);
- }
- load(reload: boolean = false) {
- if (reload) {
- this.grid.pageIndex = 1 ;
- }
- // ������������������ExpressionChangedAfterItHasBeenCheckedError
- setTimeout(() => {
- this.grid.loading = true;
- }, 1);
- this.organizationService.getPagingList(this.grid, this.queryMap.value).subscribe(
- (res: PageBean) => {
- this.grid.loading = true;
- if (res != null && res.data != null) {
- this.grid.initData(res);
- this.grid.refreshStatus();
- setTimeout(() => {
- this.grid.loading = false;
- }, 1);
- }
- }
- );
- }
-
-// rowData���null���������������
- addOrModify(d) {
- const data = {};
- if ( d != null) {
- Object.assign(data, d);
- }
- const cols = this.organization;
- this.modalHelper.static(OrganizationEditComponent, { cols , data }).subscribe(
- ( ret: { data: any, close: Function} ) => {
- // ������������
- if (ret.data['index'] != null ) {
- const index: number = ret.data['index'] ;
- const origData = this.grid.getData()[index];
- const isModified = Object.keys(origData).some(
- (key: string) => {
- return ret.data[key] !== origData[key];
- }
- );
- // ������������
- if (!isModified) {
- ret.close();
- this.msgSrv.success('���������������������������');
- return;
- }
- }
- this.organizationService.save(ret.data).subscribe(
- ( res: any) => {
- if (res.code === 1) {
- this.load();
- ret.close();
- this.msgSrv.success('���������������������');
- }
- }
- );
- });
- }
-
- delete(...id: number[]) {
- this.organizationService.delete( ...id ).subscribe(
- ( res: any) => {
- if (res.code === 1) {
- this.load();
- this.msgSrv.success('���������������������������');
- }
- }
- );
- }
-
- deleteSelected() {
- this.confirmServ.confirm({
- title: '������������',
- content: '������������������������������������������������',
- okText: '������',
- cancelText: '������'
- }).on('onOk', () => {
- if (this.grid.selectedIndexs != null && this.grid.selectedIndexs.length > 0) {
- const ids = this.grid.selectedIndexs.map(
- (index: number) => {
- const id = this.grid.data[index].id;
- return Number.parseInt(id);
- }
- );
- this.delete( ...ids );
- }
- });
- }
- sort(field: string, value: string) {
- // ������������field
- this.grid.sorts = this.grid.sorts.filter(
- (fn: string) => {
- return fn !== field;
- }
- );
- // ������value������null������������������������������filed
- if ( value != null ) {
- this.grid.sorts.push(field);
- }
- this.load();
- }
-
- reset(ls: any[]) {
- for (const item of ls) item.value = false;
- this.load(true);
- }
}
--
Gitblit v1.8.0