webpackJsonp([9],{

/***/ 313:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OperationListPageModule", function() { return OperationListPageModule; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ionic_angular__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__operation_list__ = __webpack_require__(339);
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};



var OperationListPageModule = (function () {
    function OperationListPageModule() {
    }
    OperationListPageModule = __decorate([
        Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["I" /* NgModule */])({
            declarations: [
                __WEBPACK_IMPORTED_MODULE_2__operation_list__["a" /* OperationListPage */],
            ],
            imports: [
                __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["h" /* IonicPageModule */].forChild(__WEBPACK_IMPORTED_MODULE_2__operation_list__["a" /* OperationListPage */]),
            ],
        })
    ], OperationListPageModule);
    return OperationListPageModule;
}());

//# sourceMappingURL=operation-list.module.js.map

/***/ }),

/***/ 339:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return OperationListPage; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ionic_angular__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__service_appHttpService__ = __webpack_require__(19);
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};



var OperationListPage = (function () {
    function OperationListPage(navCtrl, navParams, appService) {
        this.navCtrl = navCtrl;
        this.navParams = navParams;
        this.appService = appService;
        this.pageNumber = 0;
        this.pageSize = 10;
        this.hasmore = true;
        //操作记录总数
        this.totalNum = 0;
        //加载页数据
        this.pageOperations = [];
        //临时页数据
        this.tempOperations = [];
        this.initMineOperationInfo(0);
    }
    OperationListPage.prototype.ionViewDidLoad = function () {
        console.log('ionViewDidLoad OperationListPage');
        //this.initMineOperationInfo();
    };
    ///操作记录  （首页）
    OperationListPage.prototype.initMineOperationInfo = function (pageNumber) {
        var _this = this;
        this.appService.ObserverHttpPost("/wisdomgroup/opertion/searchOperationInfo", { "P_pageNumber": pageNumber * this.pageSize, "P_pageSize": this.pageSize })
            .subscribe(function (res) {
            var data = res.json();
            _this.operations = data.list;
            _this.totalNum = data.total;
            _this.operations.forEach(function (element) {
                var timegap = Date.parse(new Date().toString()) - Date.parse(element["opertionTime"].toString());
                var timegapvalue = _this.timeshift(timegap);
                element["timegapvalue"] = timegapvalue;
            });
            //数据不足一页的时候隐藏 ion-infinate-scroll
            if (_this.operations.length < _this.pageSize) {
                _this.hasmore = false;
            }
            //数据第一页即为最后一页时
            if (_this.operations.length == _this.totalNum) {
                _this.hasmore = false;
            }
        }, function (error) {
            _this.appService.alert('网络异常！');
        });
        return this.operations;
    };
    OperationListPage.prototype.timeshift = function (timegap) {
        var result;
        var nd = 1000 * 24 * 60 * 60; //一天的毫秒数
        var nh = 1000 * 60 * 60; //一小时的毫秒数
        var nm = 1000 * 60; //一分钟的毫秒数
        var ns = 1000; //一秒钟的毫秒数
        var day = Math.round(timegap / nd); //计算差多少天
        var hour = Math.round(timegap % nd / nh); //计算差多少小时
        var min = Math.round(timegap % nd % nh / nm); //计算差多少分钟
        var sec = Math.round(timegap % nd % nh % nm / ns); //计算差多少秒//输出结果
        console.log("时间相差：" + day + "天" + hour + "小时" + min + "分钟" + sec + "秒。");
        if (day > 0) {
            result = day + "天前";
        }
        else if (hour > 0) {
            result = hour + "小时前";
        }
        else if (min > 0) {
            result = min + "分钟前";
        }
        else {
            result = sec + "几秒前";
        }
        //result = day+"天"+hour+"小时"+min+"分钟"+sec+"秒"+"前";
        return result;
    };
    //操作记录（下拉产生的数据）
    OperationListPage.prototype.doInfinite = function (infiniteScroll) {
        var _this = this;
        this.scrollPage(function (result) {
            _this.tempOperations = result.list;
            _this.totalNum = result.total;
            if (_this.tempOperations.length > 0) {
                //计算间隔时间
                _this.tempOperations.forEach(function (element) {
                    var timegap = Date.parse(new Date().toString()) - Date.parse(element["opertionTime"].toString());
                    var timegapvalue = _this.timeshift(timegap);
                    element["timegapvalue"] = timegapvalue;
                });
                _this.pageOperations = _this.pageOperations.concat(_this.tempOperations);
                console.log("scroll:" + JSON.stringify(_this.pageOperations));
                infiniteScroll.complete(); //当数据请求完成调用
            }
            //数据少于一页时  隐藏 ion-infinate-scroll
            if (_this.tempOperations.length < _this.pageSize) {
                _this.hasmore = false;
                infiniteScroll.enable(false);
            }
            //最后一页数据时   隐藏 ion-infinate-scroll
            if (_this.pageOperations.length + _this.operations.length == _this.totalNum) {
                _this.hasmore = false;
                infiniteScroll.enable(false);
            }
        });
    };
    OperationListPage.prototype.scrollPage = function (callback) {
        var _this = this;
        this.appService.ObserverHttpPost("/wisdomgroup/opertion/searchOperationInfo", { "P_pageNumber": ++this.pageNumber * this.pageSize, "P_pageSize": this.pageSize })
            .subscribe(function (res) {
            var data = res.json();
            callback(data == null ? "[]" : data);
        }, function (error) {
            _this.appService.alert('网络异常！');
        });
        return this.tempOperations;
    };
    OperationListPage.prototype.goBack = function () {
        this.navCtrl.popToRoot();
    };
    OperationListPage = __decorate([
        Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */])({
            selector: 'page-operation-list',template:/*ion-inline-start:"/Users/ben/gitLab-project/wisdom-ces/src/pages/operation-list/operation-list.html"*/'<ion-header>\n    <ion-toolbar>\n        <div class="searchToolBar">\n            <button ion-button clear small navPop style="padding: 0;" (click)="goBack()">\n                <img class="back-btn" src="./assets/imgs/back.png" />\n            </button>\n            <ion-title text-center>\n                操作记录({{totalNum}})\n            </ion-title>\n        </div>\n\n    </ion-toolbar>\n</ion-header>\n\n\n<ion-content class="content" direction="y" scrollbar-y="true">\n    <ion-list>\n        <ion-item *ngFor="let operation of operations">\n\n            <div class="content-box">\n                <div class="content-item-box">\n                    <label class="left-title">操作名称：</label>\n                    <div class="data-box">\n                        <div class="data">{{operation.opertionObject}}</div>\n                        <button class="btn">{{operation.timegapvalue}}</button>\n                    </div>\n                </div>\n                <div class="content-item-box">\n                    <label class="left-title">操作模块：</label>\n                    <div class="data data-1">{{operation.opertionType}}</div>\n                </div>\n                <div class="content-item-box">\n                    <label class="left-title">操作时间：</label>\n                    <div class="data">{{operation.opertionTime}}</div>\n                </div>\n                <div class="content-item-box">\n                    <label class="left-title">操作内容：</label>\n                    <div class="data data-1">{{operation.opertionContent}}</div>\n                </div>\n            </div>\n\n        </ion-item>\n\n\n        <ion-item *ngFor="let operation of pageOperations">\n\n            <div class="content-box">\n                <div class="content-item-box">\n                    <label class="left-title">操作名称：</label>\n                    <div class="data-box">\n                        <div class="data">{{operation.opertionObject}}</div>\n                        <button class="btn">{{operation.timegapvalue}}</button>\n                    </div>\n                </div>\n                <div class="content-item-box">\n                    <label class="left-title">操作模块：</label>\n                    <div class="data data-1">{{operation.opertionType}}</div>\n                </div>\n                <div class="content-item-box">\n                    <label class="left-title">操作时间：</label>\n                    <div class="data">{{operation.opertionTime}}</div>\n                </div>\n                <div class="content-item-box">\n                    <label class="left-title">操作内容：</label>\n                    <div class="data data-1">{{operation.opertionContent}}</div>\n                </div>\n            </div>\n\n        </ion-item>\n\n\n        <ion-infinite-scroll (ionInfinite)="doInfinite($event)" *ngIf="hasmore" threshold="10px">\n            <ion-infinite-scroll-content loadingSpinner="bubbles" loadingText="加载更多...">\n            </ion-infinite-scroll-content>\n        </ion-infinite-scroll>\n\n    </ion-list>\n</ion-content>'/*ion-inline-end:"/Users/ben/gitLab-project/wisdom-ces/src/pages/operation-list/operation-list.html"*/,
        }),
        __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1_ionic_angular__["j" /* NavController */],
            __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["k" /* NavParams */],
            __WEBPACK_IMPORTED_MODULE_2__service_appHttpService__["b" /* AppService */]])
    ], OperationListPage);
    return OperationListPage;
}());

//# sourceMappingURL=operation-list.js.map

/***/ })

});
//# sourceMappingURL=9.js.map