webpackJsonp([6],{

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

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

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

/***/ }),

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

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return OutGoingReportEditPage; });
/* 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 OutGoingReportEditPage = (function () {
    function OutGoingReportEditPage(navCtrl, navParams, appService, storage) {
        //当前页面----个人报备1页面
        this.navCtrl = navCtrl;
        this.navParams = navParams;
        this.appService = appService;
        this.storage = storage;
        this.isLeave = false;
        this.addressid = '';
        this.syn_addressid = '';
        //报备
        this.premanager = {};
        //个人报备
        this.userpre = {
            id: "",
            managerId: "",
            isorFromsh: 0,
            leaveTime: "",
            backTime: "",
            userpreDesc: "",
            outaddressids: "" //个人报备选择的地点地址：保存id值
        };
        //临时离沪信息
        this.temp_userpre = {};
        //详细说明展示
        this.isCover = false;
        //this.gettemp_userprePre();
    }
    OutGoingReportEditPage.prototype.ngOnInit = function () {
        var _this = this;
        //报备列表页面  到  个人报备1页面
        this.storage.get("premanager").then(function (value) {
            if (value != null && value != '') {
                _this.premanager = value;
                //加载报备的图片 
                _this.picture = __WEBPACK_IMPORTED_MODULE_3__service_appHttpService__["a" /* AppGlobal */].picture + _this.premanager["uploadPic"];
                //加载报备详细说明
                _this.subIntroduce(_this.premanager["managerDesc"]);
                _this.userpre.managerId = _this.premanager["id"]; //1.保存-报备id
                _this.temp_endTime = _this.premanager["endTime"]; //报备截止时间
                if (_this.premanager["reported"]) {
                    //编辑初始化：查询
                    _this.appService.ObserverHttpPost("/wisdomgroup/modules/userpre/getUserpre", { premanagerId: value.id })
                        .subscribe(function (res) {
                        var result = res.json();
                        _this.userpre.id = result["id"]; //保存-id
                        //离沪勾选
                        if (result.isorFromsh == 1) {
                            _this.userpre.isorFromsh = 1;
                            _this.isLeave = true;
                            _this.edit_CityList = result.areaList;
                            if (_this.edit_CityList != null && _this.edit_CityList.length > 0) {
                                _this.addressid = '';
                                _this.locations = '';
                                for (var index = 0; index < _this.edit_CityList.length; index++) {
                                    var element = _this.edit_CityList[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.userpre.outaddressids = _this.addressid; //保存-离沪地点
                            }
                            _this.userpre.leaveTime = result["formshTime"]; //保存-离沪时间
                            _this.userpre.backTime = result["comeshTime"]; //保存-回沪时间 
                            if (result.userpreDesc != '' || typeof (result.userpreDesc) != 'undefined') {
                                _this.userpre.userpreDesc = result["userpreDesc"]; //保存-离沪说明
                            }
                            //页面显示 时间差
                            _this.dategap = _this.userpre.leaveTime + "~" + _this.userpre.backTime; //回显时间差
                        }
                    }, function (error) {
                        _this.appService.alert('网络异常！');
                    });
                }
            }
        });
        //此操作只从报备列表页面到此页面，仅执行一次（不然每次都初始化了）
        this.storage.remove("premanager");
        this.gettemp_userprePre();
    };
    OutGoingReportEditPage.prototype.gettemp_userprePre = function () {
        var _this = this;
        //从个人报备2页面  到 个人报备1页面
        this.storage.get("temp_userpre").then(function (value) {
            if (value != null && value != '') {
                _this.isLeave = true;
                _this.userpre.isorFromsh = 1;
                //temp_userpre 保存的是个人报备2 页面中选择的值
                _this.temp_userpre = value;
                _this.userpre.leaveTime = _this.temp_userpre["leaveDate"];
                _this.userpre.backTime = _this.temp_userpre["backDate"];
                if (value.managerDesc != '' || typeof (value.managerDesc) != 'undefined') {
                    _this.userpre.userpreDesc = _this.temp_userpre["managerDesc"];
                }
                _this.userpre.outaddressids = _this.temp_userpre["outaddressids"];
                _this.userpre.managerId = _this.temp_userpre["managerId"];
                //编辑  （存在个人报备id）
                if (_this.temp_userpre["id"] != null && _this.temp_userpre["id"] != '') {
                    _this.userpre.id = _this.temp_userpre["id"];
                }
                //页面显示 时间差
                _this.dategap = _this.temp_userpre["leaveDate"].substring(0, 10) + "~" + _this.temp_userpre["backDate"].substring(0, 10);
                _this.locations = _this.temp_userpre["areaName"];
                _this.temp_endTime = _this.temp_userpre["entTime"];
                _this.picture = __WEBPACK_IMPORTED_MODULE_3__service_appHttpService__["a" /* AppGlobal */].picture + _this.temp_userpre["premanagerImg"];
                _this.premanager["managerDesc"] = _this.temp_userpre["premanagerIntroduce"];
                _this.subIntroduce(_this.temp_userpre["premanagerIntroduce"]);
            }
        });
    };
    //具体介绍
    OutGoingReportEditPage.prototype.hidden = function () {
        this.isCover = false;
    };
    OutGoingReportEditPage.prototype.show = function () {
        this.isCover = true;
    };
    //报备详情限定一行17个字符串，两行57个字符串，多余以省略号代替
    OutGoingReportEditPage.prototype.subIntroduce = function (str) {
        console.log("introduce:" + str.length);
        if (!str)
            this.introduce = '';
        if (str.length <= 17)
            this.introduce = str;
        if (str.length > 17 && str.length <= 25)
            this.introduce = str.substr(0, 17) + "...";
        if (str.length > 25 && str.length <= 42)
            this.introduce = str.substr(0, 25) + "...";
        if (str.length > 42)
            this.introduce = str.substr(0, 42) + "...";
    };
    //选择是否离沪
    OutGoingReportEditPage.prototype.chooseLeave = function (status) {
        if (status == 1) {
            this.isLeave = false;
            this.userpre.isorFromsh = 0;
            this.userpre.leaveTime = "";
            this.userpre.backTime = "";
            this.userpre.userpreDesc = "";
            this.userpre.outaddressids = "";
        }
        else if (status == 0) {
            this.isLeave = true;
            this.userpre.isorFromsh = 1;
        }
    };
    // 跳转到报备详情页面页面
    OutGoingReportEditPage.prototype.editReport = function () {
        this.storage.remove("city");
        this.navCtrl.push("OutGoingReportDetailPage", { premanager: this.premanager });
    };
    //提交报备
    OutGoingReportEditPage.prototype.savePremanager = function () {
        var _this = this;
        if (this.userpre.isorFromsh == 1) {
            //判断离沪地点是否选择
            if (this.userpre.outaddressids == null || this.userpre.outaddressids == '') {
                this.appService.alert("请填写离沪详情信息！");
                return false;
            }
            if (this.userpre.userpreDesc != null && this.userpre.userpreDesc != '') {
                //离沪乱码处理
                var temp_userpreDesc = encodeURIComponent(this.userpre["userpreDesc"]);
                this.userpre.userpreDesc = temp_userpreDesc;
            }
        }
        //判断报备截止日期
        var signflag = Date.parse(this.temp_endTime.toString()) > Date.parse(new Date().toString());
        if (!signflag) {
            this.appService.alert('超过报备截至时间！');
            return false;
        }
        // if(this.userpre.userpreDesc != null && this.userpre.userpreDesc != '' ){
        //     //离沪乱码处理
        //     let temp_userpreDesc =  encodeURIComponent(this.userpre["userpreDesc"]) ;
        //     this.userpre.userpreDesc = temp_userpreDesc;
        // }
        this.appService.ObserverHttpPost("/wisdomgroup/modules/userpre/create", this.userpre)
            .subscribe(function (res) {
            var resultback = res.json();
            if (resultback.code == '200') {
                //this.appService.popToastView(resultback.msg,'middle',1000);  
                _this.navCtrl.push("MyReportPage");
                _this.storage.remove("premanager");
                _this.storage.remove("temp_userpre");
                _this.storage.remove("managerId");
                _this.storage.remove("city");
                _this.storage.remove("cityList");
            }
            else {
                //失败
                _this.appService.popToastView(resultback.msg, 'middle', 1000);
            }
        }, function (error) {
            _this.appService.alert('网络异常！');
        });
    };
    //修改报备
    OutGoingReportEditPage.prototype.editPremanager = function () {
        var _this = this;
        if (this.userpre.isorFromsh == 1) {
            //判断离沪地点是否选择
            if (this.userpre.outaddressids == null || this.userpre.outaddressids == '') {
                this.appService.alert("请填写离沪详情信息！");
                return false;
            }
            if (this.userpre.userpreDesc != null && this.userpre.userpreDesc != '') {
                //离沪乱码处理
                var temp_userpreDesc = encodeURIComponent(this.userpre["userpreDesc"]);
                this.userpre.userpreDesc = temp_userpreDesc;
            }
        }
        this.storage.get("cityList").then(function (value) {
            if (value != null && value != '') {
                _this.addressid = '';
                for (var index = 0; index < value.length; index++) {
                    var element = value[index];
                    _this.addressid += element["id"] + ",";
                }
                _this.addressid = _this.addressid.substring(0, _this.addressid.lastIndexOf(","));
                _this.userpre.outaddressids = _this.addressid;
            } //编辑或者是选择不离沪   
            _this.savePremanager_sysn(_this.userpre, function (result) {
                var resultback = result;
                if (resultback.code == '200') {
                    //this.appService.popToastView(resultback.msg,'middle',1000);  
                    _this.navCtrl.push("MyReportPage");
                }
                else {
                    //失败
                    _this.appService.popToastView(resultback.msg, 'middle', 1000);
                }
            });
        });
    };
    //防止异步
    OutGoingReportEditPage.prototype.savePremanager_sysn = function (userprev, callback) {
        var _this = this;
        this.appService.ObserverHttpPost("/wisdomgroup/modules/userpre/create", userprev)
            .toPromise()
            .then(function (res) {
            _this.storage.remove("premanager");
            _this.storage.remove("temp_userpre");
            _this.storage.remove("managerId");
            _this.storage.remove("city");
            _this.storage.remove("cityList");
            var data = res.json();
            callback(data == null ? "[]" : data);
        })
            .catch(function (error) {
        });
    };
    OutGoingReportEditPage = __decorate([
        Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */])({
            selector: 'page-outGoingReportEdit',template:/*ion-inline-start:"/Users/ben/gitLab-project/wisdom-ces/src/pages/outGoingReportEdit/outGoingReportEdit.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  <div class="item1">\n    <div class="img-box">\n      <!-- <img class="item1-image" src="./assets/imgs/logo.png"> -->\n\n      <img class="item1-image" src="{{picture}}">\n     \n\n    </div>\n    <div class="item1-content">\n      <div class="item1-content-header">\n        <div class="item1-title">{{premanager.title}}</div>\n      </div>\n      <div class="item1-introduction">\n       {{introduce}}\n        <button class="btn-introduce" (click)="show()">详细说明</button>\n      </div>\n    </div>\n  </div>\n  <ion-list>\n    <ion-item>\n      <div class="report-info">\n        报备信息\n      </div>\n    </ion-item>\n    <ion-item>\n      <!-- <div class="report-item">\n        <div class="report-item-title">离沪</div>\n        <img class="right-icon" src="./assets/imgs/right.png" *ngIf="isLeave" (click)="chooseLeave(1)">\n        <img class="right-icon" src="./assets/imgs/right-grey.png" *ngIf="!isLeave" (click)="chooseLeave(0)">\n      </div> -->\n\n      <div class="report-item">\n        <div class="report-item-title">不离沪</div>\n        <img class="right-icon" src="./assets/imgs/right.png" *ngIf="!isLeave" (click)="chooseLeave(0)">\n        <img class="right-icon" src="./assets/imgs/right-grey.png" *ngIf="isLeave" (click)="chooseLeave(1)">\n       \n        <div class="report-item-title">离沪</div>\n        \n        <img class="right-icon" src="./assets/imgs/right.png" *ngIf="isLeave" (click)="chooseLeave(1)">\n        <img class="right-icon" src="./assets/imgs/right-grey.png" *ngIf="!isLeave" (click)="chooseLeave(0)">\n        \n      </div>\n\n    </ion-item>\n    <ion-item *ngIf="isLeave" (click)="editReport()">\n      <div class="report-item">\n        <div class="report-item-title">离沪详情信息</div>\n        <div class="report-item-content">\n          <span>{{dategap}}</span>\n          <img class="right-icon" src="./assets/imgs/right-arrow.png" >\n        </div>\n      </div>\n    </ion-item>\n\n    <ion-item *ngIf="isLeave">\n      <div class="report-item">\n        <div class="report-item-title">离沪地点信息</div>\n        <div class="report-item-content">\n          <span>{{locations}}</span>\n        </div>\n      </div>\n    </ion-item>\n\n  </ion-list>\n  <button ion-button block class="report-btn" (click)="savePremanager()" *ngIf="!premanager.reported">提交报备</button>\n  <button ion-button block class="report-btn" (click)="editPremanager()" *ngIf="premanager.reported">修改报备</button>\n</ion-content>\n\n\n<div class="cover" *ngIf="isCover">\n	<div class="cover-content">\n		<div class="cover-content-box">\n			<h4 class="cover-content-title">具体介绍</h4>\n			<div class="cover-content-info">\n				<p>\n          {{premanager.managerDesc}}\n				</p>\n			</div>\n			<button ion-button block (click)="hidden()">\n				关闭\n			</button>\n		</div>\n	</div>\n</div>'/*ion-inline-end:"/Users/ben/gitLab-project/wisdom-ces/src/pages/outGoingReportEdit/outGoingReportEdit.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 */]])
    ], OutGoingReportEditPage);
    return OutGoingReportEditPage;
}());

//# sourceMappingURL=outGoingReportEdit.js.map

/***/ })

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