UNPKG

@angular-jz/jz

Version:

jim jz

80 lines 3.67 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (this && this.__assign) || Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; Object.defineProperty(exports, "__esModule", { value: true }); var jz_page_component_1 = require("./jz-page.component"); var utility_1 = require("../../utility"); var JZCreatePageComponentConfig = /** @class */ (function (_super) { __extends(JZCreatePageComponentConfig, _super); function JZCreatePageComponentConfig() { return _super !== null && _super.apply(this, arguments) || this; } return JZCreatePageComponentConfig; }(jz_page_component_1.JZPageComponentConfig)); exports.JZCreatePageComponentConfig = JZCreatePageComponentConfig; var JZCreatePageComponent = /** @class */ (function (_super) { __extends(JZCreatePageComponent, _super); function JZCreatePageComponent(injector, config) { var _this = _super.call(this, injector, config) || this; _this.injector = injector; ///配置页面使用的服务pageService以及页面加载时是否自动调用loadPage方法来加载页面初始化数据 _this.config = new JZCreatePageComponentConfig(); ///当前页面的数据项对象 _this.item = {}; ///创建条目成功后的回调函数 _this.createItemSucess = function (data) { _this.operating = false; _this.operationSucess(data); _this.activeModal.close({ success: true, data: data }); }; ///创建条目失败后的回调函数 _this.createItemFailed = function (error) { _this.operating = false; _this.operationFailed(error); }; _this.config = __assign({}, _this.config, config); return _this; } ///页面与服务器端访问数据进行初始化,填充了字典dics,设置了item的值 JZCreatePageComponent.prototype.loadPage = function () { var _this = this; if (this.config.needLoadPage) { this.pageService.loadCreateItemPage(this.criteria).then(function (data) { utility_1.PageUtility.fillDics(data, _this.dics); _this.item = data.item; if (_this.onAfterLoadPage) _this.onAfterLoadPage.call(_this, data); }); } }; ///调用创建条目的服务 JZCreatePageComponent.prototype.createItem = function () { this.operating = true; this.pageService.createItem({ item: this.item }).then(this.createItemSucess, this.createItemFailed); }; ///如果当前是对话框,关闭自己 JZCreatePageComponent.prototype.closeItem = function () { if (this.isDialog) { this.activeModal.close('closeItem'); } }; return JZCreatePageComponent; }(jz_page_component_1.JZPageComponent)); exports.JZCreatePageComponent = JZCreatePageComponent; //# sourceMappingURL=jz-create-page.component.js.map