@wjya/ngx-webapp-icpc.group.pms
Version:
angular webapp : icpc.group.pms
84 lines • 6.25 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var data_source_helper_1 = require("../../service/data-source.helper");
var ngx_webapp_fx_1 = require("@wjya/ngx-webapp-fx");
var core_1 = require("@angular/core");
var router_1 = require("@angular/router");
var ng_zorro_antd_1 = require("ng-zorro-antd");
var GroupInfoAdminComponent = /** @class */ (function () {
function GroupInfoAdminComponent(dataSourceHelper, userStorageService, activateRoute, confirmServ) {
this.dataSourceHelper = dataSourceHelper;
this.userStorageService = userStorageService;
this.activateRoute = activateRoute;
this.confirmServ = confirmServ;
this.groupInfo = {};
this.isAdd = false;
this.data = [];
this.admin = {};
this.dataSource = dataSourceHelper.communityGroupAdmin;
this.deteleAdminDataSource = dataSourceHelper.deleteCommunityGroupAdmin;
}
GroupInfoAdminComponent.prototype.ngOnInit = function () {
this.communityGroupId = this.userStorageService.getCurrentOffice().id;
this.loadAll();
};
GroupInfoAdminComponent.prototype.loadAll = function () {
var _this = this;
this.dataSource.findList({
communityGroupId: this.communityGroupId
}).subscribe(function (res) {
_this.data = res.body;
});
};
GroupInfoAdminComponent.prototype.isDelete = function (item) {
if (this.groupInfo) {
if (this.groupInfo.masterId) {
if (this.groupInfo.masterId === item.id) {
return false;
}
return true;
}
}
return true;
};
GroupInfoAdminComponent.prototype.onSave = function () {
var _this = this;
this.dataSource.create(null, { communityGroupId: this.communityGroupId, name: this.admin.name, mobilePhone: this.admin.phone }).subscribe(function (success) {
_this.admin = {};
_this.loadAll();
});
};
GroupInfoAdminComponent.prototype.delete = function (val) {
var _self = this;
this.confirmServ.confirm({
title: '您确定要删除此管理员?',
onOk: function () {
_self.deteleAdminDataSource.deleteOne(val.mobilePhone, { communityGroupId: _self.communityGroupId }).subscribe(function (success) {
_self.loadAll();
});
}
});
};
GroupInfoAdminComponent.decorators = [
{ type: core_1.Component, args: [{
selector: 'zx-group-info-admin',
template: "<zx-content-block><nz-card nzNoHovering nzBordered=\"false\"><ng-template #title><h4>\u7CFB\u7EDF\u7BA1\u7406\u5458</h4></ng-template><ng-template #body><p>\u6B64\u5904\u8BBE\u7F6E\u7684\u7CFB\u7EDF\u7BA1\u7406\u5458\u5C06\u81EA\u52A8\u62E5\u6709\u96C6\u56E2\u6700\u5927\u6743\u9650\uFF0C\u7CFB\u7EDF\u7BA1\u7406\u5458\u53EF\u4F7F\u7528\u624B\u673A\u53F7\u767B\u5F55\u3002\u6700\u591A\u53EF\u4EE5\u6DFB\u52A05\u4E2A\u7CFB\u7EDF\u7BA1\u7406\u5458\u3002</p><div nz-row class=\"admin-box\" [nzGutter]=\"24\"><div nz-col [nzSpan]=\"3\" *ngFor=\"let item of data\"><div><div>{{item.name}}</div><div>{{item.mobilePhone||'[ \u672A\u7ED1\u5B9A\u624B\u673A\u53F7 ]'}}</div><i class=\"anticon anticon-close\" (click)=\"delete(item)\" *ngIf=\"data.length > 1 && isDelete(item) \"></i> <i class=\"anticon anticon-lock\" *ngIf=\"!isDelete(item) \"></i></div></div><div nz-col [nzSpan]=\"3\" class=\"admin-add\" *ngIf=\"data.length !== 5\"><i class=\"anticon anticon-plus\" *ngIf=\"!isAdd\" (click)=\"isAdd = !isAdd\"></i><div *ngIf=\"isAdd\" class=\"add-box\"><nz-input [nzSize]=\"'large'\" [nzPlaceHolder]=\"'\u59D3\u540D'\" [(ngModel)]=\"admin.name\"></nz-input><nz-input [nzSize]=\"'large'\" [nzType]=\"'number'\" [nzPlaceHolder]=\"'\u624B\u673A\u53F7\u7801'\" [(ngModel)]=\"admin.phone\"></nz-input><div class=\"admin-extra\"><i class=\"anticon anticon-check\" (click)=\"onSave()\"></i> <i class=\"anticon anticon-close\" (click)=\"isAdd = false\"></i></div></div></div></div></ng-template></nz-card></zx-content-block>",
styles: [
"\n :host .admin-box > div{\n margin:18px 0;\n height: 148px;\n }\n :host .admin-box > div > div:not(.add-box){\n border:1px solid rgba(217, 217, 217, 1);\n padding: 40px 8px;\n text-align:center;\n position:relative;\n height:148px;\n }\n :host .admin-box > div > div > div {\n padding: 6px;\n }\n :host .admin-box > div > div > i{\n position: absolute;\n top: 10px;\n right: 10px;\n font-size: 20px;\n color: #6666;\n cursor: pointer;\n }\n :host .admin-add{\n border: 1px dashed rgba(217, 217, 217, 1);\n display: flex;\n justify-content: center;\n align-items: center;\n color: #999;\n cursor: pointer;\n }\n :host .admin-add > i{\n font-size: 70px;\n }\n :host .admin-extra{\n position: absolute;\n top:0;\n right:0;\n font-size: 20px;\n color: #6666;\n }\n :host .admin-extra > i{\n margin-left:5px;\n }\n :host ::ng-deep .add-box nz-input{\n margin-top:15px;\n }\n "
]
},] },
];
/** @nocollapse */
GroupInfoAdminComponent.ctorParameters = function () { return [
{ type: data_source_helper_1.DataSourceHelper, },
{ type: ngx_webapp_fx_1.UserStorageService, },
{ type: router_1.ActivatedRoute, },
{ type: ng_zorro_antd_1.NzModalService, },
]; };
GroupInfoAdminComponent.propDecorators = {
"groupInfo": [{ type: core_1.Input },],
};
return GroupInfoAdminComponent;
}());
exports.GroupInfoAdminComponent = GroupInfoAdminComponent;
//# sourceMappingURL=group-info-admin.component.js.map