@wjya/ngx-webapp-icpc.group.pms
Version:
angular webapp : icpc.group.pms
76 lines • 5.83 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 forms_1 = require("@angular/forms");
var ngx_webapp_fx_1 = require("@wjya/ngx-webapp-fx");
var ngx_utils_1 = require("@wjya/ngx-utils");
var CarparkDialogComponent = /** @class */ (function () {
function CarparkDialogComponent(fb, dataSourceHelper, userStorageService) {
this.fb = fb;
this.dataSourceHelper = dataSourceHelper;
this.userStorageService = userStorageService;
this.clickSave = new core_1.EventEmitter();
this.modalIsVisible = false;
this.options = [];
this.dataSource = this.dataSourceHelper.communities;
this.communityGroupId = this.userStorageService.getCurrentOffice().id;
this.validateForm = this.fb.group({
id: [null],
name: [null, [forms_1.Validators.required]],
berthTotal: [null, [forms_1.Validators.required]],
address: [null, [forms_1.Validators.required]],
communityId: [null, [forms_1.Validators.required]],
});
}
CarparkDialogComponent.prototype.ngOnInit = function () {
var _this = this;
this.dataSource.findList({
communityGroupId: this.communityGroupId
}).subscribe(function (res) {
_this.options = res.body;
});
};
CarparkDialogComponent.prototype.getFormControl = function (name) {
return this.validateForm.controls[name];
};
CarparkDialogComponent.prototype.setFormValue = function (dataRow) {
this.data = ngx_utils_1.ObjectUtils.cloneObject(dataRow, true);
this.modalIsVisible = true;
this.validateForm.patchValue(this.data);
};
CarparkDialogComponent.prototype.handleCancel = function () {
this.modalIsVisible = false;
};
CarparkDialogComponent.prototype.onSave = function (value) {
this.clickSave.emit(ngx_utils_1.ObjectUtils.patchFieldValue(value, this.data));
};
CarparkDialogComponent.prototype.resetForm = function () {
this.validateForm.reset();
for (var _i = 0, _a = Object.keys(this.validateForm.controls); _i < _a.length; _i++) {
var key = _a[_i];
this.validateForm.controls[key].markAsPristine();
}
};
CarparkDialogComponent.decorators = [
{ type: core_1.Component, args: [{
selector: 'zx-carpark-dialog',
template: "<nz-modal [nzVisible]=\"modalIsVisible\" [nzWidth]=\"600\" [nzTitle]=\"modalTitle\" [nzContent]=\"modalContent\" [nzFooter]=\"modalFooter\" (nzOnCancel)=\"handleCancel()\"><ng-template #modalTitle><span>\u65B0\u5EFA\u8F66\u573A</span> <span>\u8BF7\u8F93\u65B0\u5EFA\u8F66\u573A\u6240\u9700\u586B\u5199\u7684\u4FE1\u606F</span></ng-template><ng-template #modalContent><form nz-form [formGroup]=\"validateForm\"><div nz-form-item nz-row class=\"hidden\"><div nz-form-label nz-col [nzSpan]=\"24\"><label>ID</label></div><div nz-col [nzSpan]=\"24\" nz-form-control><nz-input formControlName=\"id\" [nzPlaceHolder]=\"'ID'\" [nzSize]=\"'large'\"></nz-input></div></div><div nz-form-item nz-row><div nz-form-label nz-col [nzSpan]=\"4\"><label nz-form-item-required>\u8F66\u573A\u540D\u79F0</label></div><div nz-col [nzSpan]=\"20\" nz-form-control nzHasFeedback><nz-input formControlName=\"name\" [nzPlaceHolder]=\"'\u8BF7\u8F93\u5165\u8F66\u573A\u540D\u79F0'\" [nzSize]=\"'large'\"></nz-input></div></div><div nz-form-item nz-row><div nz-form-label nz-col [nzSpan]=\"4\"><label nz-form-item-required>\u8F66\u4F4D\u603B\u6570</label></div><div nz-col [nzSpan]=\"20\" nz-form-control nzHasFeedback><nz-input formControlName=\"berthTotal\" [nzType]=\"'number'\" [nzPlaceHolder]=\"'\u8BF7\u8F93\u5165\u8F66\u4F4D\u603B\u6570'\" [nzSize]=\"'large'\"></nz-input></div></div><div nz-form-item nz-row><div nz-form-label nz-col [nzSpan]=\"4\"><label nz-form-item-required>\u8F66\u573A\u5730\u5740</label></div><div nz-col [nzSpan]=\"20\" nz-form-control nzHasFeedback><nz-input formControlName=\"address\" [nzPlaceHolder]=\"'\u8BF7\u8F93\u5165\u8F66\u573A\u5730\u5740'\" [nzSize]=\"'large'\"></nz-input></div></div><div nz-form-item nz-row><div nz-form-label nz-col [nzSpan]=\"4\"><label nz-form-item-required>\u96B6\u5C5E\u5C0F\u533A</label></div><div nz-col [nzSpan]=\"20\" nz-form-control><nz-select formControlName=\"communityId\" [nzPlaceHolder]=\"'\u8BF7\u9009\u62E9\u96B6\u5C5E\u5C0F\u533A'\" [nzSize]=\"'large'\" nzAllowClear><nz-option *ngFor=\"let option of options\" [nzLabel]=\"option.name\" [nzValue]=\"option.id\"></nz-option></nz-select></div></div></form></ng-template><ng-template #modalFooter><button nz-button [nzType]=\"'primary'\" [nzSize]=\"'large'\" (click)=\"handleCancel()\"><span>\u5173 \u95ED</span></button> <button nz-button [nzType]=\"'primary'\" [nzSize]=\"'large'\" (click)=\"onSave(validateForm.value)\" [disabled]=\"!validateForm.valid\"><span>\u4FDD \u5B58</span></button></ng-template></nz-modal>",
styles: [
"\n :host .hidden {\n display: none;\n }\n "
]
},] },
];
/** @nocollapse */
CarparkDialogComponent.ctorParameters = function () { return [
{ type: forms_1.FormBuilder, },
{ type: data_source_helper_1.DataSourceHelper, },
{ type: ngx_webapp_fx_1.UserStorageService, },
]; };
CarparkDialogComponent.propDecorators = {
"clickSave": [{ type: core_1.Output },],
};
return CarparkDialogComponent;
}());
exports.CarparkDialogComponent = CarparkDialogComponent;
//# sourceMappingURL=carpark-dialog.component.js.map