@wjya/ngx-webapp-icpc.group.pms
Version:
angular webapp : icpc.group.pms
64 lines • 4.15 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var data_source_helper_1 = require("../service/data-source.helper");
var core_1 = require("@angular/core");
var ngx_webapp_fx_1 = require("@wjya/ngx-webapp-fx");
var setting_child_template_component_1 = require("./setting-child-template.component");
var SettingComponent = /** @class */ (function () {
function SettingComponent(userStorageService, dataSourceHelper) {
this.userStorageService = userStorageService;
this.dataSourceHelper = dataSourceHelper;
this.data = [];
this.dataSource = this.dataSourceHelper.settings;
this.communityGroupId = this.userStorageService.getCurrentOffice().id;
this.loadAll();
}
SettingComponent.prototype.ngOnInit = function () { };
SettingComponent.prototype.loadAll = function () {
var _this = this;
this.dataSource.findList({
communityGroupId: this.communityGroupId
}).subscribe(function (res) {
_this.data = res.body;
_this.evalValue(_this.data);
});
};
SettingComponent.prototype.evalValue = function (data) {
var _this = this;
if (!data) {
return;
}
data.forEach(function (child) {
if (child.valueType === 'BOOLEAN') {
// tslint:disable-next-line:no-eval
child.value = eval(child.value);
}
if (child.children) {
_this.evalValue(child.children);
}
});
};
SettingComponent.prototype.save = function (val) {
this.settingChild.save(val);
};
SettingComponent.decorators = [
{ type: core_1.Component, args: [{
selector: 'zx-setting',
template: "<zx-header-block [title]=\"'\u53C2\u6570\u8BBE\u7F6E'\" [showBottomLine]=\"false\" [showBreadcrumb]=\"true\"><p>\u672C\u673A\u6784\u53C2\u6570\u8BBE\u7F6E</p></zx-header-block><ng-container *ngFor=\"let item of data\"><zx-content-block *ngIf=\"item.visibility\"><nz-card nzNoHovering nzBordered=\"false\"><ng-template #title><h4>{{item.label}}({{item.name}})</h4></ng-template><ng-template #body><nz-collapseset [nzBordered]=\"false\"><nz-collapse [nzTitle]=\"item.label\" [nzActive]=\"item.active\"><nz-input [(ngModel)]=\"item.value\" [nzSize]=\"'large'\" *ngIf=\"item.valueType === 'STRING'\" [nzDisabled]=\"!item.editable\" (ngModelChange)=\"save(item)\"></nz-input><label nz-checkbox [(ngModel)]=\"item.value\" *ngIf=\"item.valueType === 'BOOLEAN'\" [nzDisabled]=\"!item.editable\" (ngModelChange)=\"save(item)\"></label><nz-select [(ngModel)]=\"item.value\" [nzSize]=\"'large'\" *ngIf=\"item.valueOptions\" [nzDisabled]=\"!item.editable\" (ngModelChange)=\"save(item)\"><nz-option *ngFor=\"let option of item.parseValueOptions\" [nzLabel]=\"option.label\" [nzValue]=\"option.value\" (ngModelChange)=\"save(item)\"></nz-option></nz-select><p *ngIf=\"item.tip\" class=\"tip\">{{item.tip}}</p><zx-setting-child-template [data]=\"item?.children\" #settingChild></zx-setting-child-template></nz-collapse></nz-collapseset></ng-template></nz-card></zx-content-block></ng-container>",
styles: [
"\n :host .tip{\n margin-top:10px;\n }\n :host ::ng-deep .ant-card-body{\n padding:16px 24px;\n }\n :host ::ng-deep .ant-collapse-content-box nz-input,\n :host ::ng-deep .ant-collapse-content-box nz-select {\n width:500px;\n }\n "
]
},] },
];
/** @nocollapse */
SettingComponent.ctorParameters = function () { return [
{ type: ngx_webapp_fx_1.UserStorageService, },
{ type: data_source_helper_1.DataSourceHelper, },
]; };
SettingComponent.propDecorators = {
"settingChild": [{ type: core_1.ViewChild, args: ['settingChild',] },],
};
return SettingComponent;
}());
exports.SettingComponent = SettingComponent;
//# sourceMappingURL=setting.component.js.map