fengxiang
2018-03-13 6a6d3bbb3748c12c2dc94beec05d21d82d0faba1
数据报表
8 files modified
1004 ■■■■■ changed files
src/app/routes/dashboard/workplace/workplace.component.html 313 ●●●●● patch | view | raw | blame | history
src/app/routes/dashboard/workplace/workplace.component.less 148 ●●●●● patch | view | raw | blame | history
src/app/routes/dashboard/workplace/workplace.component.ts 501 ●●●●● patch | view | raw | blame | history
src/app/routes/report/report.component.html 25 ●●●●● patch | view | raw | blame | history
src/app/routes/report/report.component.ts 4 ●●●● patch | view | raw | blame | history
src/app/routes/reports/demo/demo.component.html 2 ●●● patch | view | raw | blame | history
src/app/routes/reports/demo/demo.component.ts 4 ●●●● patch | view | raw | blame | history
src/app/routes/routes-routing.module.ts 7 ●●●●● patch | view | raw | blame | history
src/app/routes/dashboard/workplace/workplace.component.html
@@ -2,7 +2,6 @@
    <ng-template #breadcrumb>
        <nz-breadcrumb>
            <nz-breadcrumb-item><a [routerLink]="['/']">首页</a></nz-breadcrumb-item>
            <nz-breadcrumb-item><a [routerLink]="['/']">Dashboard</a></nz-breadcrumb-item>
            <nz-breadcrumb-item>工作台</nz-breadcrumb-item>
        </nz-breadcrumb>
    </ng-template>
@@ -10,28 +9,328 @@
        <div class="page-header">
            <div class="avatar"><nz-avatar nzSize="large" nzSrc="https://gw.alipayobjects.com/zos/rmsportal/lctvVCLfRpYCkYxAsiVQ.png"></nz-avatar></div>
            <div class="desc">
                <div class="desc-title">早安,山治,我要吃肉!</div>
                <p>假砖家 | 地球-伟大航道-黄金梅丽号-厨房-小强部门</p>
                <div class="desc-title">你好,admin!</div>
                <p>系统管理员 | 中国-江苏省-苏州市-昆山市-摩瑞尔电器</p>
            </div>
        </div>
    </ng-template>
    <ng-template #extra>
        <div class="page-extra">
            <div>
                <p>项目数</p>
                <p>56</p>
                <p>组织</p>
                <p>8<span> / 24</span></p>
            </div>
            <div>
                <p>团队内排名</p>
                <p>8<span> / 24</span></p>
                <p>监控点</p>
                <p>20</p>
            </div>
        <!--
            <div>
                <p>监控仪</p>
                <p>1532</p>
            </div>
            <div>
                <p>项目访问</p>
                <p>2,223</p>
            </div>
        -->
        </div>
    </ng-template>
</pro-header>
<div nz-row [nzGutter]="24" class="pt-lg" style="margin-top: -24px">
    <div nz-col nzXs="24" nzSm="12" nzMd="12" nzLg="6">
        <chart-card
            [title]="'监控仪台数'"
            total="{{totalDeviceCount}}"
            contentHeight="46px"
            [action]="action1"
            [footer]="footer1">
            <ng-template #action1>
                <nz-tooltip [nzTitle]="'包括最近一年已安装的监控仪设备的总台数'">
                    <nz-icon nz-tooltip nzType="info-circle-o"></nz-icon>
                </nz-tooltip>
            </ng-template>
            <!--
            <trend flag="up" style="display:block; margin-top:2px;">周同比<span class="pl-sm">12%</span></trend>
            <trend flag="down">日环比<span class="pl-sm">11%</span></trend>
            -->
            <mini-bar height="46" [data]="totalDeviceCountList"></mini-bar>
            <ng-template #footer1>
                <p class="text-truncate">月均新增台数:<span class="ml-sm">{{avgDeviceCount}}</span></p>
            </ng-template>
        </chart-card>
    </div>
    <div nz-col nzXs="24" nzSm="12" nzMd="12" nzLg="6">
        <chart-card [title]="'正常运行占比'"
                    total="78%"
                    contentHeight="46px"
                    [action]="action2"
                    [footer]="footer2">
            <ng-template #action2>
                <nz-tooltip [nzTitle]="'当前处于正常运行状态的监控设备的占比'">
                    <nz-icon nz-tooltip nzType="info-circle-o"></nz-icon>
                </nz-tooltip>
            </ng-template>
            <mini-progress
                height="46"
                percent="78"
                strokeWidth="8"
                target="80"
                color="#13C2C2"></mini-progress>
            <ng-template #footer2>
                <div class="d-flex justify-content-between">
                    <trend flag="up">周同比<span class="pl-sm">8%</span></trend>
                    <trend flag="down">日环比<span class="pl-sm">2%</span></trend>
                </div>
            </ng-template>
        </chart-card>
    </div>
    <div nz-col nzXs="24" nzSm="12" nzMd="12" nzLg="6">
        <chart-card [title]="'报警次数'"
                    total="8,848"
                    contentHeight="46px"
                    [action]="action3"
                    [footer]="footer3">
            <ng-template #action3>
                <nz-tooltip [nzTitle]="'最近一年所属设备的报警次数统计'">
                    <nz-icon nz-tooltip nzType="info-circle-o"></nz-icon>
                </nz-tooltip>
            </ng-template>
            <mini-area
                color="#975FE4"
                height="46"
                [data]="data.visitData"></mini-area>
            <ng-template #footer3>
                <p class="text-truncate">月度报警次数:<span class="ml-sm">1,234</span></p>
            </ng-template>
        </chart-card>
    </div>
    <div nz-col nzXs="24" nzSm="12" nzMd="12" nzLg="6">
        <chart-card [title]="'虚拟机台数'"
                    total="6,560"
                    contentHeight="46px"
                    [action]="action4"
                    [footer]="footer4">
            <ng-template #action4>
                <nz-tooltip [nzTitle]="'最近一年新增的监控模拟设备总台数'">
                    <nz-icon nz-tooltip nzType="info-circle-o"></nz-icon>
                </nz-tooltip>
            </ng-template>
            <mini-bar
                height="46"
                color="orange"
                [data]="data.visitData"></mini-bar>
            <ng-template #footer4>
                <p class="text-truncate">月均新增台数:<span class="ml-sm">220</span></p>
            </ng-template>
        </chart-card>
    </div>
</div>
<nz-card [nzLoading]="loading" [nzBordered]="false" nzNoPadding class="sales-card">
    <ng-template #body>
        <nz-tabset>
            <nz-tab>
                <ng-template #nzTabHeading>销售额</ng-template>
                <div nz-row>
                    <div nz-col nzXs="24" nzSm="24" nzMd="12" nzLg="16">
                        <div class="bar">
                            <bar
                                height="295"
                                [title]="'销售额趋势'"
                                [data]="data.salesData"></bar>
                        </div>
                    </div>
                    <div nz-col nzXs="24" nzSm="24" nzMd="12" nzLg="8">
                        <div class="rank-list">
                            <h4 class="rank-title">门店销售额排名</h4>
                            <ul>
                                <li *ngFor="let i of rankingListData; let idx = index">
                                    <div>
                                        <span class="icon" [ngClass]="{'active': idx < 3}">{{idx+1}}</span>
                                        {{i.title}}
                                    </div>
                                    <span>{{i.total | number: '3.0'}}</span>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </nz-tab>
            <nz-tab>
                <ng-template #nzTabHeading>访问量</ng-template>
                <div nz-row>
                    <div nz-col nzXs="24" nzSm="24" nzMd="12" nzLg="16">
                        <div class="bar">
                            <bar
                                height="295"
                                [title]="'访问量趋势'"
                                [data]="data.salesData"></bar>
                        </div>
                    </div>
                    <div nz-col nzXs="24" nzSm="24" nzMd="12" nzLg="8">
                        <div class="rank-list">
                            <h4 class="rank-title">门店访问量排名</h4>
                            <ul>
                                <li *ngFor="let i of rankingListData; let idx = index">
                                    <div>
                                        <span class="icon" [ngClass]="{'active': idx < 3}">{{idx+1}}</span>
                                        {{i.title}}
                                    </div>
                                    <span>{{i.total | number: '3.0'}}</span>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </nz-tab>
            <ng-template #nzTabBarExtraContent>
                <div class="sales-extra-wrap">
                    <div class="sales-extra">
                        <a (click)="setDate('today')">今日</a>
                        <a (click)="setDate('week')">本周</a>
                        <a (click)="setDate('month')">本月</a>
                        <a (click)="setDate('year')">全年</a>
                    </div>
                    <nz-datepicker style="width:120px" class="mr-md" [(ngModel)]="q.start" [nzFormat]="'YYYY-MM-DD'" [nzPlaceHolder]="'开始日期'"></nz-datepicker>
                    <nz-datepicker style="width:120px" [(ngModel)]="q.end" [nzFormat]="'YYYY-MM-DD'" [nzPlaceHolder]="'结束日期'"></nz-datepicker>
                </div>
            </ng-template>
        </nz-tabset>
    </ng-template>
</nz-card>
<div nz-row [nzGutter]="24">
    <div nz-col nzXs="24" nzSm="24" nzMd="24" nzLg="12">
        <nz-card [nzLoading]="loading" [nzBordered]="false" nzTitle="线上热门搜索">
            <ng-template #extra>
                <nz-dropdown>
                    <nz-icon class="icon-group" nz-dropdown nzType="ellipsis"></nz-icon>
                    <ul nz-menu>
                        <li nz-menu-item>操作一</li>
                        <li nz-menu-item>操作二</li>
                    </ul>
                </nz-dropdown>
            </ng-template>
            <ng-template #body>
                <div nz-row [nzGutter]="64">
                    <div nz-col nzXs="24" nzSm="12" class="mb-md">
                        <number-info total="12,321" subTotal="17.1" status="up" [subTitle]="subTitle">
                            <ng-template #subTitle>
                                搜索用户数
                                <nz-tooltip [nzTitle]="'指标文案'">
                                    <nz-icon nz-tooltip nzType="info-circle-o" class="ml-sm"></nz-icon>
                                </nz-tooltip>
                            </ng-template>
                        </number-info>
                        <mini-area [line]="true" height="45" [data]="data.visitData2"></mini-area>
                    </div>
                    <div nz-col nzXs="24" nzSm="12" class="mb-md">
                        <number-info subTitle="人均搜索次数" total="2.7" subTotal="26.2" status="down"></number-info>
                        <mini-area [line]="true" height="45" [data]="data.visitData2"></mini-area>
                    </div>
                </div>
                <nz-table #keyTable [nzDataSource]="data.searchData" [nzPageSize]="5" nzSize="small">
                    <thead nz-thead>
                    <tr>
                        <th nz-th><span>排名</span></th>
                        <th nz-th><span>搜索关键词</span></th>
                        <th nz-th class="text-right">
                            <span>用户数</span>
                            <nz-table-sort (nzValueChange)="sort('count',$event)"></nz-table-sort>
                        </th>
                        <th nz-th class="text-right">
                            <span>周涨幅</span>
                            <nz-table-sort (nzValueChange)="sort('range',$event)"></nz-table-sort>
                        </th>
                    </tr>
                    </thead>
                    <tbody nz-tbody>
                    <tr nz-tbody-tr *ngFor="let i of keyTable.data">
                        <td nz-td>{{i.index}}</td>
                        <td nz-td><a (click)="msg.success(i.keyword)">{{i.keyword}}</a></td>
                        <td nz-td class="text-right">{{i.count}}</td>
                        <td nz-td class="text-right">
                            <trend [flag]="i.status === 1 ? 'down' : 'up'">
                                <span>{{i.range}}%</span>
                            </trend>
                        </td>
                    </tr>
                    </tbody>
                </nz-table>
            </ng-template>
        </nz-card>
    </div>
    <div nz-col nzXs="24" nzSm="24" nzMd="24" nzLg="12">
        <nz-card [nzLoading]="loading" [nzBordered]="false" nzTitle="销售额类别占比" [nzBodyStyle]="{'padding.px': 24}" class="sales-card" style="min-height: 482px;">
            <ng-template #extra>
                <div class="sales-card-extra">
                    <nz-dropdown>
                        <nz-icon class="icon-group" nz-dropdown nzType="ellipsis"></nz-icon>
                        <ul nz-menu>
                            <li nz-menu-item>操作一</li>
                            <li nz-menu-item>操作二</li>
                        </ul>
                    </nz-dropdown>
                    <div class="sales-type-radio">
                        <nz-radio-group [(ngModel)]="salesType" (ngModelChange)="changeSaleType()" [nzSize]="'large'">
                            <label nz-radio-button [nzValue]="'all'"><span>全部渠道</span></label>
                            <label nz-radio-button [nzValue]="'online'"><span>线上</span></label>
                            <label nz-radio-button [nzValue]="'offline'"><span>门店</span></label>
                        </nz-radio-group>
                    </div>
                </div>
            </ng-template>
            <ng-template #body>
                <h4 class="margin:8px 0 32px 0;">销售额</h4>
                <pie
                    [hasLegend]="true"
                    subTitle="销售额"
                    [height]="248"
                    [lineWidth]="4"
                    [total]="salesTotal"
                    [data]="salesPieData"
                    [valueFormat]="handlePieValueFormat">
                </pie>
            </ng-template>
        </nz-card>
    </div>
</div>
<nz-card [nzLoading]="loading" [nzBordered]="false" [nzBodyStyle]="{'padding': '0 0 32px'}" class="offline-card mt-lg">
    <ng-template #body>
        <nz-tabset [(nzSelectedIndex)]="_activeTab" (nzSelectChange)="_tabChange($event)">
            <nz-tab *ngFor="let tab of data.offlineData; let i = index;">
                <ng-template #nzTabHeading>
                    <div nz-row [nzGutter]="8" style="width: 138px; margin: 8px 0">
                        <div nz-col [nzSpan]="12">
                            <number-info
                                [title]="tab.name"
                                subTitle="转化率"
                                gap="2"
                                [total]="(tab.cvr * 100) + '%'"
                                [theme]="i !== _activeTab && 'light'"></number-info>
                        </div>
                        <div nz-col [nzSpan]="12" style="padding-top: 36px">
                            <pie
                                [animate]="false"
                                [color]="i !== _activeTab && '#BDE4FF'"
                                [inner]="0.55"
                                [tooltip]="false"
                                [padding]="[0, 0, 0, 0]"
                                [percent]="tab.cvr * 100"
                                [height]="64">
                            </pie>
                        </div>
                    </div>
                </ng-template>
                <div class="px-lg">
                    <timeline [data]="tab.chart"
                              [titleMap]="{ y1: '客流量', y2: '支付笔数' }"></timeline>
                </div>
            </nz-tab>
        </nz-tabset>
    </ng-template>
</nz-card>
<div nz-row [nzGutter]="24">
    <div nz-col nzXs="24" nzSm="24" nzMd="16">
        <nz-card nzTitle="进行中的项目" [nzBordered]="false" [nzLoading]="loading" nzNoPadding class="mb-lg project-list">
src/app/routes/dashboard/workplace/workplace.component.less
@@ -238,4 +238,152 @@
            }
        }
    }
    .icon-group {
        transition: color 0.32s;
        color: @text-color-secondary;
        cursor: pointer;
        margin-left: 16px;
        &:hover {
            color: @text-color;
        }
    }
    .rank-list {
        padding: 0px 32px 32px 72px;
        ul {
            margin-top: 25px;
        }
        li {
            zoom: 1;
            margin-top: 16px;
            display: flex;
            justify-content: space-between;
            .icon {
                background-color: #f5f5f5;
                border-radius: 20px;
                display: inline-block;
                font-size: 12px;
                font-weight: 600;
                margin-right: 24px;
                height: 20px;
                line-height: 20px;
                width: 20px;
                text-align: center;
            }
            .active {
                background-color: #314659;
                color: #fff;
            }
        }
    }
    .sales-extra {
        display: inline-block;
        margin-right: 24px;
        a {
            margin-left: 24px;
        }
    }
    .sales-card {
        .bar {
            padding: 0px 0px 32px 32px;
        }
        .rank {
            padding: 0 32px 32px 72px;
        }
        .ant-tabs-tab {
            padding-top: 16px;
            padding-bottom: 14px;
            line-height: 24px;
        }
        .ant-tabs-extra-content {
            padding-right: 24px;
            line-height: 55px;
        }
        .ant-card-head {
            position: relative;
        }
    }
    .sales-card-extra {
        height: 68px;
    }
    .sales-type-radio {
        position: absolute;
        left: 24px;
        bottom: 15px;
    }
    .offline-card {
        .ant-tabs-ink-bar {
            bottom: auto;
        }
        .ant-tabs-bar {
            border-bottom: none;
        }
        .ant-tabs-nav-container-scrolling {
            padding-left: 40px;
            padding-right: 40px;
        }
        .ant-tabs-tab-prev-icon:before {
            position: relative;
            left: 6px;
        }
        .ant-tabs-tab-next-icon:before {
            position: relative;
            right: 6px;
        }
    }
    .trend-text {
        margin-left: 8px;
        color: @heading-color;
    }
    @media screen and (max-width: @screen-lg) {
        .sales-extra {
            display: none;
        }
        .rank-list {
            li {
                span:first-child {
                    margin-right: 8px;
                }
            }
        }
    }
    @media screen and (max-width: @screen-md) {
        .rank-title {
            margin-top: 16px;
        }
        .sales-card .bar {
            padding: 16px;
        }
    }
    @media screen and (max-width: @screen-sm) {
        .sales-extra-wrap {
            display: none;
        }
        .sales-card {
            .ant-tabs-content {
                padding-top: 30px;
            }
        }
    }
    .ant-table-pagination {
        margin-bottom: 0;
    }
}
src/app/routes/dashboard/workplace/workplace.component.ts
@@ -3,6 +3,8 @@
import { NzMessageService } from 'ng-zorro-antd';
import { getTimeDistance, yuan, fixedZero } from '@delon/abc';
import { _HttpClient } from '@delon/theme';
import {HttpClient} from '@angular/common/http';
import * as moment from 'moment';
@Component({
    selector: 'app-dashboard-workplace',
@@ -10,6 +12,11 @@
    styleUrls: ['./workplace.component.less']
})
export class DashboardWorkplaceComponent implements OnInit, OnDestroy {
    totalDeviceCountList: any[] = [];
    totalDeviceCount = 0;
    avgDeviceCount: string;
    notice: any[] = [];
    activities: any[] = [];
    radarData: any[] = [];
@@ -76,27 +83,481 @@
      ];
    // endregion
    constructor(private http: _HttpClient, public msg: NzMessageService) {}
    ngOnInit() {
        // zip(
        //     this.http.get('/chart'),
        //     this.http.get('/api/notice'),
        //     this.http.get('/api/activities')
        // ).subscribe(([ chart, notice, activities ]) => {
        //     this.radarData = chart['radarData'];
        //     this.notice = <any []>notice;
        //     this.activities = (<any []>activities).map((item: any) => {
        //         item.template = item.template.split(/@\{([^{}]*)\}/gi).map((key: string) => {
        //             if (item[key]) return `<a>${item[key].name}</a>`;
        //             return key;
        //         });
        //         return item;
        //     });
        //     this.loading = false;
        // });
    ngOnDestroy(): void {
    }
    ngOnDestroy(): void {
    data: any = {
        salesData: [],
        offlineData: []
    };
    q: any = {
        start: null,
        end: null
    };
    rankingListData: any[] = Array(7).fill({}).map((item, i) => {
        return {
            title: `工专路 ${i} 号店`,
            total: 323234
        };
    });
    constructor(private http: _HttpClient, public msg: NzMessageService,
                private http2: HttpClient) {}
    ngOnInit() {
        const today = new Date().getTime();
        const fakeDC = [60, 135, 70, 112, 80, 170, 200, 140, 52, 119, 164, 230];
        for (let i = 0; i < 12; i += 1) {
            this.totalDeviceCountList.push({
                x: moment(today).subtract(-1*i, 'months').format(
                    "YYYY-MM"
                ),
                y: fakeDC[i]
            });
            this.totalDeviceCount += fakeDC[i];
        }
        this.avgDeviceCount = (this.totalDeviceCount/12).toFixed(0);
        const visitData = [];
        const beginDay = new Date().getTime();
        const fakeY = [7, 5, 4, 2, 4, 7, 5, 6, 5, 9, 6, 3, 1, 5, 3, 6, 5];
        for (let i = 0; i < fakeY.length; i += 1) {
            visitData.push({
                x: moment(new Date(beginDay + 1000 * 60 * 60 * 24 * i)).format(
                    "YYYY-MM-DD"
                ),
                y: fakeY[i]
            });
        }
        const visitData2 = [];
        const fakeY2 = [1, 6, 4, 8, 3, 7, 2];
        for (let i = 0; i < fakeY2.length; i += 1) {
            visitData2.push({
                x: moment(new Date(beginDay + 1000 * 60 * 60 * 24 * i)).format(
                    "YYYY-MM-DD"
                ),
                y: fakeY2[i]
            });
        }
        const salesData = [];
        for (let i = 0; i < 12; i += 1) {
            salesData.push({
                x: `${i + 1}月`,
                y: Math.floor(Math.random() * 1000) + 200
            });
        }
        const salesTypeData = [
            {
                x: "家用电器",
                y: 4544
            },
            {
                x: "食用酒水",
                y: 3321
            },
            {
                x: "个护健康",
                y: 3113
            },
            {
                x: "服饰箱包",
                y: 2341
            },
            {
                x: "母婴产品",
                y: 1231
            },
            {
                x: "其他",
                y: 1231
            }
        ];
        const salesTypeDataOnline = [
            {
                x: "家用电器",
                y: 244
            },
            {
                x: "食用酒水",
                y: 321
            },
            {
                x: "个护健康",
                y: 311
            },
            {
                x: "服饰箱包",
                y: 41
            },
            {
                x: "母婴产品",
                y: 121
            },
            {
                x: '其他',
                y: 111
            }
        ];
        const salesTypeDataOffline = [
            {
                x: '家用电器',
                y: 99
            },
            {
                x: '个护健康',
                y: 188
            },
            {
                x: '服饰箱包',
                y: 344
            },
            {
                x: '母婴产品',
                y: 255
            },
            {
                x: '其他',
                y: 65
            }
        ];
        const offlineData = [];
        for (let i = 0; i < 10; i += 1) {
            offlineData.push({
                name: `门店${i}`,
                cvr: Math.ceil(Math.random() * 9) / 10
            });
        }
        const offlineChartData = [];
        for (let i = 0; i < 20; i += 1) {
            offlineChartData.push({
                x: new Date().getTime() + 1000 * 60 * 30 * i,
                y1: Math.floor(Math.random() * 100) + 10,
                y2: Math.floor(Math.random() * 100) + 10
            });
        }
        const radarOriginData = [
            {
                name: '个人',
                ref: 10,
                koubei: 8,
                output: 4,
                contribute: 5,
                hot: 7
            },
            {
                name: '团队',
                ref: 3,
                koubei: 9,
                output: 6,
                contribute: 3,
                hot: 1
            },
            {
                name: '部门',
                ref: 4,
                koubei: 1,
                output: 6,
                contribute: 5,
                hot: 7
            }
        ];
        const radarData = [];
        const radarTitleMap = {
            ref: '引用',
            koubei: '口碑',
            output: '产量',
            contribute: '贡献',
            hot: '热度'
        };
        radarOriginData.forEach(item => {
            Object.keys(item).forEach(key => {
                if (key !== 'name') {
                    radarData.push({
                        name: item.name,
                        label: radarTitleMap[key],
                        value: item[key]
                    });
                }
            });
        });
        const searchData = [];
        for (let i = 0; i < 50; i += 1) {
            searchData.push({
                index: i + 1,
                keyword: `搜索关键词-${i}`,
                count: Math.floor(Math.random() * 1000),
                range: Math.floor(Math.random() * 100),
                status: Math.floor((Math.random() * 10) % 2)
            });
        }
        var res = {
            visitData: visitData,
            salesData: salesData,
            visitData2: visitData2,
            salesTypeData: salesTypeData,
            salesTypeDataOnline: salesTypeDataOnline,
            salesTypeDataOffline: salesTypeDataOffline,
            offlineData: offlineData,
            offlineChartData: offlineChartData,
            radarOriginData: radarOriginData,
            radarData: radarData,
            searchData: searchData
        };
        res.offlineData.forEach((item: any) => {
            item.chart = Object.assign([], res.offlineChartData);
        });
        this.data = res;
        this.loading = false;
        this.changeSaleType();
        this.radarData = res.radarData;
        const titles = [
            'Alipay',
            'Angular',
            'Ant Design',
            'Ant Design Pro',
            'Bootstrap',
            'React',
            'Vue',
            'Webpack'
        ];
        const avatars = [
            'https://gw.alipayobjects.com/zos/rmsportal/WdGqmHpayyMjiEhcKoVE.png', // Alipay
            'https://gw.alipayobjects.com/zos/rmsportal/zOsKZmFRdUtvpqCImOVY.png', // Angular
            'https://gw.alipayobjects.com/zos/rmsportal/dURIMkkrRFpPgTuzkwnB.png', // Ant Design
            'https://gw.alipayobjects.com/zos/rmsportal/sfjbOqnsXXJgNCjCzDBL.png', // Ant Design Pro
            'https://gw.alipayobjects.com/zos/rmsportal/siCrBXXhmvTQGWPNLBow.png', // Bootstrap
            'https://gw.alipayobjects.com/zos/rmsportal/kZzEzemZyKLKFsojXItE.png', // React
            'https://gw.alipayobjects.com/zos/rmsportal/ComBAopevLwENQdKWiIn.png', // Vue
            'https://gw.alipayobjects.com/zos/rmsportal/nxkuOJlFJuAUhzlMTCEe.png'  // Webpack
        ];
        var notice = [
            {
                id: 'xxx1',
                title: titles[0],
                logo: avatars[0],
                description: '那是一种内在的东西, 他们到达不了,也无法触及的',
                updatedAt: new Date(),
                member: '科学搬砖组',
                href: '',
                memberLink: '',
            },
            {
                id: 'xxx2',
                title: titles[1],
                logo: avatars[1],
                description: '希望是一个好东西,也许是最好的,好东西是不会消亡的',
                updatedAt: new Date('2017-07-24'),
                member: '全组都是吴彦祖',
                href: '',
                memberLink: '',
            },
            {
                id: 'xxx3',
                title: titles[2],
                logo: avatars[2],
                description: '城镇中有那么多的酒馆,她却偏偏走进了我的酒馆',
                updatedAt: new Date(),
                member: '中二少女团',
                href: '',
                memberLink: '',
            },
            {
                id: 'xxx4',
                title: titles[3],
                logo: avatars[3],
                description: '那时候我只会想自己想要什么,从不想自己拥有什么',
                updatedAt: new Date('2017-07-23'),
                member: '程序员日常',
                href: '',
                memberLink: '',
            },
            {
                id: 'xxx5',
                title: titles[4],
                logo: avatars[4],
                description: '凛冬将至',
                updatedAt: new Date('2017-07-23'),
                member: '高逼格设计天团',
                href: '',
                memberLink: '',
            },
            {
                id: 'xxx6',
                title: titles[5],
                logo: avatars[5],
                description: '生命就像一盒巧克力,结果往往出人意料',
                updatedAt: new Date('2017-07-23'),
                member: '骗你来学计算机',
                href: '',
                memberLink: '',
            },
        ];
        this.notice = notice;
        var activities = [
            {
                id: 'trend-1',
                updatedAt: new Date(),
                user: {
                    name: '林东东',
                    avatar: avatars[0],
                },
                group: {
                    name: '高逼格设计天团',
                    link: 'http://github.com/',
                },
                project: {
                    name: '六月迭代',
                    link: 'http://github.com/',
                },
                template: '在 @{group} 新建项目 @{project}',
            },
            {
                id: 'trend-2',
                updatedAt: new Date(),
                user: {
                    name: '付小小',
                    avatar: avatars[1],
                },
                group: {
                    name: '高逼格设计天团',
                    link: 'http://github.com/',
                },
                project: {
                    name: '六月迭代',
                    link: 'http://github.com/',
                },
                template: '在 @{group} 新建项目 @{project}',
            },
            {
                id: 'trend-3',
                updatedAt: new Date(),
                user: {
                    name: '曲丽丽',
                    avatar: avatars[2],
                },
                group: {
                    name: '中二少女团',
                    link: 'http://github.com/',
                },
                project: {
                    name: '六月迭代',
                    link: 'http://github.com/',
                },
                template: '在 @{group} 新建项目 @{project}',
            },
            {
                id: 'trend-4',
                updatedAt: new Date(),
                user: {
                    name: '周星星',
                    avatar: avatars[3],
                },
                project: {
                    name: '5 月日常迭代',
                    link: 'http://github.com/',
                },
                template: '将 @{project} 更新至已发布状态',
            },
            {
                id: 'trend-5',
                updatedAt: new Date(),
                user: {
                    name: '朱偏右',
                    avatar: avatars[4],
                },
                project: {
                    name: '工程效能',
                    link: 'http://github.com/',
                },
                comment: {
                    name: '留言',
                    link: 'http://github.com/',
                },
                template: '在 @{project} 发布了 @{comment}',
            },
            {
                id: 'trend-6',
                updatedAt: new Date(),
                user: {
                    name: '乐哥',
                    avatar: avatars[5],
                },
                group: {
                    name: '程序员日常',
                    link: 'http://github.com/',
                },
                project: {
                    name: '品牌迭代',
                    link: 'http://github.com/',
                },
                template: '在 @{group} 新建项目 @{project}',
            },
        ];
        this.activities = activities.map((item: any) => {
            item.template = item.template.split(/@\{([^{}]*)\}/gi).map((key: string) => {
                if (item[key]) return `<a>${item[key].name}</a>`;
                return key;
            });
            return item;
        });
    }
    setDate(type: any) {
        const rank = getTimeDistance(type);
        this.q.start = rank[0];
        this.q.end = rank[1];
    }
    sort(sortName, sortValue) {
        this.data.searchData = [
            ...(<any[]>this.data.searchData).sort((a, b) => {
                if (a[ sortName ] > b[ sortName ]) {
                    return (sortValue === 'ascend') ? 1 : -1;
                } else if (a[ sortName ] < b[ sortName ]) {
                    return (sortValue === 'ascend') ? -1 : 1;
                } else {
                    return 0;
                }
            })
        ];
    }
    salesType = 'all';
    salesPieData: any;
    salesTotal = 0;
    changeSaleType() {
        this.salesPieData = this.salesType === 'all' ? this.data.salesTypeData : (
            this.salesType === 'online' ? this.data.salesTypeDataOnline : this.data.salesTypeDataOffline
        );
        if (this.salesPieData) this.salesTotal = this.salesPieData.reduce((pre, now) => now.y + pre, 0);
    }
    handlePieValueFormat(value: any) {
        return yuan(value);
    }
    _activeTab = 0;
    _tabChange(value: any) {
        console.log('tab', this._activeTab, value);
    }
}
src/app/routes/report/report.component.html
@@ -1,5 +1,26 @@
<html>
    <body>
        <nz-spin [nzTip]="'正在读取数据...'"[nzSize]="'large'" [nzSpinning]="spinning">
        </nz-spin>
<div *ngFor="let i of sensorArr">
    <div id ="mydiv{{i}}" style="height: 486px; width: 1000px;"></div>
        <div >
            <div id="head" style="height: 486px; width: 1000px" *ngIf="! spinning">
                <h1>
                七星博士检测报告
                </h1>
</div>
            <div id="content" style="display: none;">
                <div *ngFor="let i of sensorArr">
                    <div id ="mydiv{{i}}" style="height: 487px; width: 1000px"></div>
                </div>
            </div>
            <div id="foot" style="height: 486px; width: 1000px" *ngIf="! spinning">
                <h1>
                检测报告结论
                </h1>
            </div>
        </div>
    </body>
</html>
src/app/routes/report/report.component.ts
@@ -14,6 +14,7 @@
export class ReportComponent implements OnInit {
  [x: string]: any;
  spinning: boolean = true;
  constructor(
    public injector: Injector,
    public http: HttpClient,
@@ -82,6 +83,7 @@
  sensorArr: any = [];
  
  ngOnInit() {
    this.activeRoute.queryParams.subscribe(params => {
      const items = JSON.parse(params.items);
      const query = params;
@@ -123,7 +125,9 @@
              $('#mydiv' + i).remove();
            }
          });
          $('#content').attr({style:"display: inline;"});
        }
        this.spinning = false;
      });
    });
  }
src/app/routes/reports/demo/demo.component.html
@@ -68,7 +68,7 @@
                        <label nz-form-item-required>时间</label>
                    </div>
                    <div nz-form-control class="flex-1">
                        <nz-datepicker style="width: 100%;" value="" [(ngModel)]="item.time" name="time{{item.id}}" id="{{item.time}}" [nzPlaceHolder]="'请选择'" [nzFormat]="time.format" [nzMode]="time.mode" [nzSize]="'large'" nzShowTime></nz-datepicker>
                        <nz-datepicker style="width: 100%;" value="" [(ngModel)]="item.time" name="time{{item.id}}" id="{{item.time}}" [nzPlaceHolder]="'请选择'" [nzFormat]="time.format" [nzMode]="time.mode" [nzSize]="'large'" nzShowTime [nzDisabledDate]="_disabledDate"></nz-datepicker>
                    </div>
                </div>
            </div>
src/app/routes/reports/demo/demo.component.ts
@@ -121,6 +121,7 @@
    {value: 'hour', label: '时', mode: 'day', xAxisName: '分', format: 'yyyy-MM-dd HH', typeFormat: '%Y-%m-%d %H:%i', timeLength: 60}
  ];
  timeType = this.typeOptions[0];
  typeChange(searchText) {
    this.typeOptions.forEach(types => {
@@ -158,4 +159,7 @@
  }
  _disabledDate(current: Date): boolean {
    return current && current.getTime() > Date.now() ;
  }
}
src/app/routes/routes-routing.module.ts
@@ -20,7 +20,14 @@
        component: LayoutDefaultComponent,
        children: [
            { path: '', redirectTo: 'dashboard/workplace', pathMatch: 'full' },
<<<<<<< HEAD
            { path: 'dashboard', redirectTo: 'dashboard/workplace', pathMatch: 'full' },
=======
            { path: 'dashboard', redirectTo: 'dashboard/v1', pathMatch: 'full' },
            { path: 'dashboard/v1', component: DashboardV1Component, data: { translate: 'dashboard_v1' } },
            { path: 'dashboard/analysis', component: DashboardAnalysisComponent, data: { translate: 'dashboard_analysis' } },
            { path: 'dashboard/monitor', component: DashboardMonitorComponent, data: { translate: 'dashboard_monitor' } },
>>>>>>> 9634327c9094fb2d2b5bb2a3e630971cd65d3112
            { path: 'dashboard/workplace', component: DashboardWorkplaceComponent, data: { translate: 'dashboard_workplace' } },
            { path: 'users', loadChildren: './users/users.module#UsersModule' },
            { path: 'devices', loadChildren: './devices/devices.module#DevicesModule' },