UNPKG

@wjya/ngx-webapp-icpc.group.pms

Version:

angular webapp : icpc.group.pms

75 lines 4.08 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var ngx_webapp_fx_1 = require("@wjya/ngx-webapp-fx"); var core_1 = require("@angular/core"); var data_source_helper_1 = require("../../service/data-source.helper"); var ng_zorro_antd_1 = require("ng-zorro-antd"); var router_1 = require("@angular/router"); var CommunityDetailOfficalComponent = /** @class */ (function () { function CommunityDetailOfficalComponent(dataSourceHelper, userStorageService, confirmServ, activateRoute, _message) { this.dataSourceHelper = dataSourceHelper; this.userStorageService = userStorageService; this.confirmServ = confirmServ; this.activateRoute = activateRoute; this._message = _message; this.officalOptions = []; this.selectedOption = {}; this.dataSource = this.dataSourceHelper.officalCommunities; this.officalDataSource = this.dataSourceHelper.officals; } CommunityDetailOfficalComponent.prototype.ngOnInit = function () { this.communityGroupId = this.userStorageService.getCurrentOffice().id; this.communityId = this.activateRoute.snapshot.params['id']; this.loadAll(); this.loadCurrentOffical(); }; CommunityDetailOfficalComponent.prototype.loadCurrentOffical = function () { var _this = this; this.officalDataSource.findList({ communityGroupId: this.communityGroupId, communityId: this.communityId }).subscribe(function (res) { if (res.body.length > 0) { _this.selectedOption = res.body[0].id; } }); }; CommunityDetailOfficalComponent.prototype.loadAll = function () { var _this = this; this.officalDataSource.findList({ communityGroupId: this.communityGroupId }).subscribe(function (res) { _this.officalOptions = res.body; }); }; CommunityDetailOfficalComponent.prototype.onSave = function () { var _this = this; this.dataSource.createOne(this.selectedOption, null, { communityGroupId: this.communityGroupId, communityId: this.communityId }).subscribe(function (success) { _this._message.success('保存成功'); _this.loadCurrentOffical(); }); }; CommunityDetailOfficalComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'zx-community-detail-offical', template: "<zx-content-block><nz-card nzNoHovering nzBordered=\"false\"><ng-template #title><h4>\u516C\u4F17\u53F7\u7ED1\u5B9A</h4></ng-template><ng-template #extra><div class=\"extra\"><span><i class=\"anticon anticon-save\"></i> <a (click)=\"onSave()\">\u4FDD\u5B58</a></span></div></ng-template><ng-template #body><div nz-row><div nz-col [nzSpan]=\"6\"><nz-select [(ngModel)]=\"selectedOption\" [nzPlaceHolder]=\"'\u8BF7\u9009\u62E9\u516C\u4F17\u53F7'\" style=\"width: 100%\"><nz-option *ngFor=\"let option of officalOptions\" [nzLabel]=\"option.name\" [nzValue]=\"option.id\"></nz-option></nz-select></div></div></ng-template></nz-card></zx-content-block>", styles: [ "\n :host .extra {\n color: #108ee9;\n }\n :host .extra > span:nth-child(2) {\n margin-left:16px;\n }\n " ] },] }, ]; /** @nocollapse */ CommunityDetailOfficalComponent.ctorParameters = function () { return [ { type: data_source_helper_1.DataSourceHelper, }, { type: ngx_webapp_fx_1.UserStorageService, }, { type: ng_zorro_antd_1.NzModalService, }, { type: router_1.ActivatedRoute, }, { type: ng_zorro_antd_1.NzMessageService, }, ]; }; return CommunityDetailOfficalComponent; }()); exports.CommunityDetailOfficalComponent = CommunityDetailOfficalComponent; //# sourceMappingURL=community-detail-offical.component.js.map