@wjya/ngx-webapp-icpc.group.pms
Version:
angular webapp : icpc.group.pms
62 lines • 3.54 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("@angular/core");
var forms_1 = require("@angular/forms");
var WechatMenuDialogComponent = /** @class */ (function () {
function WechatMenuDialogComponent(fb) {
this.fb = fb;
this.clickSave = new core_1.EventEmitter();
this.modalIsVisible = false;
this.data = {};
this.validateForm = this.fb.group({
name: [null, [forms_1.Validators.required]],
});
}
WechatMenuDialogComponent.prototype.ngOnInit = function () { };
WechatMenuDialogComponent.prototype.handleCancel = function () {
this.modalIsVisible = false;
};
WechatMenuDialogComponent.prototype.dialog = function (item) {
this.resetForm();
this.modalIsVisible = true;
this.data = item;
};
WechatMenuDialogComponent.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();
}
};
WechatMenuDialogComponent.prototype.getFormControl = function (name) {
return this.validateForm.controls[name];
};
WechatMenuDialogComponent.prototype.onSave = function (val) {
val.children = [];
val.id = 999;
if (this.data.length !== undefined) {
this.data.push(val);
this.clickSave.emit(this.data);
}
else {
this.data.children.push(val);
this.clickSave.emit(this.data);
}
};
WechatMenuDialogComponent.decorators = [
{ type: core_1.Component, args: [{
selector: 'zx-wechat-menu-dialog',
template: "<nz-modal [nzVisible]=\"modalIsVisible\" [nzWidth]=\"600\" [nzTitle]=\"modalTitle\" [nzContent]=\"modalContent\" [nzFooter]=\"modalFooter\" (nzOnCancel)=\"handleCancel()\"><ng-template #modalTitle><span>\u8BF7\u8F93\u5165\u83DC\u5355\u540D\u79F0</span></ng-template><ng-template #modalContent><form nz-form [formGroup]=\"validateForm\"><div nz-form-item nz-row><div nz-form-label nz-col [nzSpan]=\"4\"><label nz-form-item-required>\u83DC\u5355\u540D\u79F0</label></div><div nz-col [nzSpan]=\"20\" nz-form-control nzHasFeedback><nz-input formControlName=\"name\" [nzPlaceHolder]=\"'\u8BF7\u8F93\u5165\u83DC\u5355\u540D\u79F0'\" [nzSize]=\"'large'\"></nz-input><div nz-form-explain *ngIf=\"getFormControl('name').dirty&&getFormControl('name').hasError('required')\">\u83DC\u5355\u540D\u79F0\u662F\u5FC5\u586B\u7684!</div></div></div></form></ng-template><ng-template #modalFooter><button nz-button [nzType]=\"'default'\" [nzSize]=\"'large'\" (click)=\"handleCancel()\"><span>\u53D6 \u6D88</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>"
},] },
];
/** @nocollapse */
WechatMenuDialogComponent.ctorParameters = function () { return [
{ type: forms_1.FormBuilder, },
]; };
WechatMenuDialogComponent.propDecorators = {
"clickSave": [{ type: core_1.Output },],
};
return WechatMenuDialogComponent;
}());
exports.WechatMenuDialogComponent = WechatMenuDialogComponent;
//# sourceMappingURL=wechat-menu-dialog.component.js.map