UNPKG

@angular-jz/jz

Version:

jim jz

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