webpackJsonp([7],{

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

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OutGoingReportDetailModule", function() { return OutGoingReportDetailModule; });
/* 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__outGoingReportDetail_outGoingReportDetail__ = __webpack_require__(341);
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 OutGoingReportDetailModule = (function () {
    function OutGoingReportDetailModule() {
    }
    OutGoingReportDetailModule = __decorate([
        Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["I" /* NgModule */])({
            declarations: [
                __WEBPACK_IMPORTED_MODULE_2__outGoingReportDetail_outGoingReportDetail__["a" /* OutGoingReportDetailPage */],
            ],
            imports: [
                __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["h" /* IonicPageModule */].forChild(__WEBPACK_IMPORTED_MODULE_2__outGoingReportDetail_outGoingReportDetail__["a" /* OutGoingReportDetailPage */]),
            ],
        })
    ], OutGoingReportDetailModule);
    return OutGoingReportDetailModule;
}());

//# sourceMappingURL=outGoingReportDetail.module.js.map

/***/ }),

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

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return OutGoingReportDetailPage; });
/* 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__ionic_storage__ = __webpack_require__(28);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__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 OutGoingReportDetailPage = (function () {
    function OutGoingReportDetailPage(navCtrl, navParams, appService, storage) {
        //当前页面---个人报备页面2 （临时存储离沪数据）
        var _this = this;
        this.navCtrl = navCtrl;
        this.navParams = navParams;
        this.appService = appService;
        this.storage = storage;
        //临时个人报备
        this.temp_userpre = {
            id: '',
            leaveDate: '',
            backDate: '',
            managerDesc: '',
            outaddressids: '',
            managerId: '',
            areaName: '',
            entTime: '',
            premanagerImg: '',
            premanagerIntroduce: ''
        };
        //地点id,多个之间用逗号分隔
        this.addressid = "";
        //选择的所有地点
        this.allselectedCity = [];
        this.temp_city = [];
        //个人报备1——> 个人报备2页面
        this.premanager = this.navParams.get("premanager");
        this.storage.set('premanager', this.premanager);
        if (this.premanager != null) {
            if (this.premanager["reserve1"] != null && this.premanager["reserve2"] != null) {
                //原来方法：this.newLeave.dateStart=new Date().toISOString();会误差8个小时，以下方法是个简单处理技巧，仅限中国地区使用 +8*60*60*1000
                this.temp_userpre.leaveDate = new Date(this.premanager["reserve1"]).toISOString(); //假期开始时间
                this.temp_userpre.backDate = new Date(this.premanager["reserve2"]).toISOString(); //假期结束时间
            }
            this.temp_userpre.managerId = this.premanager.id;
            //报备截至时间
            this.temp_userpre.entTime = this.premanager.endTime;
            this.temp_userpre.premanagerImg = this.premanager.uploadPic;
            this.temp_userpre.premanagerIntroduce = this.premanager.managerDesc;
            //编辑初始化：查询
            if (this.premanager["reported"]) {
                this.appService.ObserverHttpPost("/wisdomgroup/modules/userpre/getUserpre", { premanagerId: this.premanager.id.toString() })
                    .subscribe(function (res) {
                    var result = res.json();
                    _this.temp_userpre.id = result.id; //临时-id 
                    if (result.isorFromsh == 1) {
                        _this.temp_userpre.managerDesc = result.userpreDesc;
                        _this.temp_userpre.leaveDate = result.formshTime;
                        _this.temp_userpre.backDate = result.comeshTime;
                        _this.allselectedCity = result.areaList; //地点回显
                        //将原保存的地点放入storage中
                        _this.storage.set("cityList", _this.allselectedCity);
                    }
                }, function (error) {
                    _this.appService.alert('网络异常！');
                });
            }
        }
        else {
            //报备
        }
        //这个操作是拿出放在storage中城市地点的集合放在 当前页面的临时temp_city中
        this.storage.get("cityList").then(function (value) {
            if (value != null && value != '') {
                _this.temp_city = value;
                _this.allselectedCity = _this.temp_city;
            }
            _this.storage.get("city").then(function (value) {
                if (value != null && value != '') {
                    //对每选择一个city都放在临时变量中再保存一次
                    _this.temp_city.push(value);
                    _this.storage.set('cityList', _this.temp_city);
                    _this.allselectedCity = _this.temp_city;
                }
                _this.storage.remove("city");
            });
        });
        //地点城市页面 到 个人报备2（本页面） 页面
        //get的目的是在地点城市页面到 个人报备2（此页面）数据仍然存在
        this.storage.get("temp_userpre").then(function (value) {
            if (value != null && value != '') {
                _this.temp_userpre = value;
            }
        });
    }
    OutGoingReportDetailPage.prototype.ngOnInit = function () {
    };
    //添加地点
    OutGoingReportDetailPage.prototype.addAddress = function () {
        this.storage.remove('city');
        this.storage.set('temp_userpre', this.temp_userpre);
        this.navCtrl.push("ChooseAddressPage");
    };
    //删除地点
    OutGoingReportDetailPage.prototype.deleteAddress = function (city) {
        var index_city = 0;
        for (var index = 0; index < this.allselectedCity.length; index++) {
            var element = this.allselectedCity[index];
            if (element["id"] == city) {
                index_city = index;
            }
        }
        this.allselectedCity.splice(index_city, 1);
        this.storage.remove("cityList");
        this.storage.set('cityList', this.allselectedCity);
    };
    //个人报备2  --> 个人报备1 页面
    //保存 按钮
    //将该页面值带入个人报备1页面 进行统一的个人报备
    OutGoingReportDetailPage.prototype.saveFieldValue = function () {
        //1.离沪时间和回沪时间不能为空
        if ((this.temp_userpre.leaveDate == null || this.temp_userpre.leaveDate == '')
            || (this.temp_userpre.backDate == null || this.temp_userpre.backDate == '')) {
            this.appService.alert("日期不能为空");
            return false;
        }
        //2.判断回沪日期和离沪日期
        var dateflag = Date.parse(this.temp_userpre.leaveDate.toString()) > Date.parse(this.temp_userpre.backDate.toString());
        if (dateflag) {
            this.appService.alert("回沪日期应大于回沪日期");
            return false;
        }
        //3.离沪地点不能为空
        if (this.allselectedCity != null && this.allselectedCity.length > 0) {
            if (this.allselectedCity != null && this.allselectedCity.length > 0) {
                this.addressid = '';
                this.locations = '';
                for (var index = 0; index < this.allselectedCity.length; index++) {
                    var element = this.allselectedCity[index];
                    this.addressid += element["id"] + ",";
                    this.locations += element["areaName"] + ",";
                }
                this.addressid = this.addressid.substring(0, this.addressid.lastIndexOf(","));
                this.locations = this.locations.substring(0, this.locations.lastIndexOf(","));
                this.temp_userpre.outaddressids = this.addressid;
                this.temp_userpre.areaName = this.locations;
            }
        }
        else {
            this.appService.alert("离沪地点不能为空");
            return false;
        }
        //this.storage.remove('temp_userpre');
        this.storage.set('temp_userpre', this.temp_userpre);
        this.navCtrl.push("OutGoingReportEditPage");
    };
    OutGoingReportDetailPage = __decorate([
        Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */])({
            selector: 'page-outGoingReportDetail',template:/*ion-inline-start:"/Users/ben/gitLab-project/wisdom-ces/src/pages/outGoingReportDetail/outGoingReportDetail.html"*/'<ion-header>\n  <ion-toolbar>\n      <div class="searchToolBar">\n          <button ion-button clear small navPop style="padding: 0;">\n              <img class="back-btn" src="./assets/imgs/back.png" />\n            </button>\n            <ion-title text-center>外出报备详情</ion-title>\n      </div>\n     \n    </ion-toolbar>\n</ion-header>\n\n<ion-content class="content">\n  <ion-list>\n    <ion-item>\n      <ion-label>离沪日期</ion-label>\n      <ion-datetime  \n            displayFormat="YYYY-MM-DD" \n            pickerFormat="YYYY-MM-DD" \n            cancelText="取消" \n            doneText="确定" \n            [(ngModel)]="temp_userpre.leaveDate" \n            placeholder="{{temp_userpre.leaveDate}}"\n            min="2018"max="2019-12-31">\n      </ion-datetime>\n    </ion-item>\n    <ion-item>\n      <ion-label>回沪日期</ion-label>\n      <ion-datetime  \n            displayFormat="YYYY-MM-DD" \n            pickerFormat="YYYY-MM-DD" \n            cancelText="取消"\n            doneText="确定" \n            [(ngModel)]="temp_userpre.backDate" \n            placeholder="{{temp_userpre.backDate}}"\n            min="2018"max="2019-12-31">\n      </ion-datetime>\n    </ion-item>\n\n    <ion-item>\n      <div class="report-item">\n        <div>外出地点</div>\n        <img class="add" src="./assets/imgs/add.png" (click)="addAddress()">\n      </div>\n    </ion-item>\n\n    <ion-item *ngFor="let city of allselectedCity">\n      <div class="report-item">\n        <div class="address-item-title">\n          <img class="delete" src="./assets/imgs/wrong.png" (click)="deleteAddress(city.id)">\n          <div *ngIf="city.inorout == 1">国内 </div>\n          <div *ngIf="city.inorout == 2">国际/港澳台</div>\n        </div>\n        <div class="address-item-content">\n          {{city.areaName}}\n        </div>\n      </div>\n    </ion-item>\n\n    <ion-item>\n      <div>离沪说明</div>\n      <textarea class="description" placeholder="请输入" [(ngModel)]="temp_userpre.managerDesc"></textarea>\n    </ion-item>\n  </ion-list>\n  <button ion-button block class="save" (click)="saveFieldValue()">保存</button>\n</ion-content>'/*ion-inline-end:"/Users/ben/gitLab-project/wisdom-ces/src/pages/outGoingReportDetail/outGoingReportDetail.html"*/
        }),
        __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1_ionic_angular__["j" /* NavController */],
            __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["k" /* NavParams */],
            __WEBPACK_IMPORTED_MODULE_3__service_appHttpService__["b" /* AppService */],
            __WEBPACK_IMPORTED_MODULE_2__ionic_storage__["b" /* Storage */]])
    ], OutGoingReportDetailPage);
    return OutGoingReportDetailPage;
}());

//# sourceMappingURL=outGoingReportDetail.js.map

/***/ })

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