UNPKG

@angular-jz/jz

Version:

jim jz

80 lines 3.62 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 JZEditPageComponentConfig = /** @class */ (function (_super) { __extends(JZEditPageComponentConfig, _super); function JZEditPageComponentConfig() { return _super !== null && _super.apply(this, arguments) || this; } return JZEditPageComponentConfig; }(jz_page_component_1.JZPageComponentConfig)); exports.JZEditPageComponentConfig = JZEditPageComponentConfig; var JZEditPageComponent = /** @class */ (function (_super) { __extends(JZEditPageComponent, _super); function JZEditPageComponent(injector, config) { var _this = _super.call(this, injector, config) || this; _this.injector = injector; ///配置页面使用的服务pageService以及页面加载时是否自动调用loadPage方法来加载页面初始化数据 _this.config = new JZEditPageComponentConfig(); ///当前页面的数据项对象 _this.item = {}; ///编辑条目成功后的回调函数 _this.editItemSucess = function (data) { _this.operating = false; _this.operationSucess(data); _this.activeModal.close({ success: true, data: data }); }; ///编辑条目失败后的回调函数 _this.editItemFailed = function (error) { _this.operating = false; _this.operationFailed(error); }; _this.config = __assign({}, _this.config, config); return _this; } ///页面与服务器端访问数据进行初始化,填充了字典dics,设置了item的值 JZEditPageComponent.prototype.loadPage = function () { var _this = this; if (this.config.needLoadPage) { this.pageService.loadEditItemPage(this.criteria).then(function (data) { utility_1.PageUtility.fillDics(data, _this.dics); _this.item = data.item; if (_this.onAfterLoadPage) _this.onAfterLoadPage.call(_this, data); }); } }; ///调用编辑条目的服务 JZEditPageComponent.prototype.editItem = function () { this.operating = true; this.pageService.editItem({ item: this.item }).then(this.editItemSucess, this.editItemFailed); }; ///如果当前是对话框,关闭自己 JZEditPageComponent.prototype.closeItem = function () { if (this.isDialog) { this.activeModal.close('closeItem'); } }; return JZEditPageComponent; }(jz_page_component_1.JZPageComponent)); exports.JZEditPageComponent = JZEditPageComponent; //# sourceMappingURL=jz-edit-page.component.js.map