UNPKG

@wjya/ngx-webapp-icpc.group.pms

Version:

angular webapp : icpc.group.pms

160 lines 7.71 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = require("@angular/core"); var ngx_webapp_fx_1 = require("@wjya/ngx-webapp-fx"); var data_source_helper_1 = require("../../service/data-source.helper"); var ng_zorro_antd_1 = require("ng-zorro-antd"); var post_dialog_component_1 = require("./post-dialog.component"); var post_authority_component_1 = require("./post-authority.component"); var def = { data: null, showOperations: true, fields: { id: { label: 'id', hidden: true, sort: { enabled: false, value: 'descend' }, query: {}, filter: { enabled: false } }, code: { label: '部门编码', sort: { enabled: true }, query: {}, filter: { enabled: false } }, name: { label: '岗位名称', sort: { enabled: true }, query: {}, filter: { enabled: false } }, remarks: { label: '岗位描述', sort: { enabled: false }, query: {}, filter: { enabled: false } }, employeeNames: { label: '岗位职员', sort: { enabled: false }, query: {}, filter: { enabled: false }, dataTemplateEnabled: true } } }; var PostComponent = /** @class */ (function () { function PostComponent(dataSourceHelper, userStorageService, injector, confirmServ) { this.dataSourceHelper = dataSourceHelper; this.userStorageService = userStorageService; this.injector = injector; this.confirmServ = confirmServ; this.dataSource = dataSourceHelper.posts; } PostComponent.prototype.ngOnInit = function () { this.listView = new ngx_webapp_fx_1.ListView(def, this.injector); this.communityGroupId = this.userStorageService.getCurrentOffice().id; this.loadAll(); }; PostComponent.prototype.loadAll = function () { var _this = this; this.dataSource.findList({ communityGroupId: this.communityGroupId, page: this.listView.pageIndex - 1, size: this.listView.pageSize, query: this.listView.params.queryString, sort: this.listView.sortValueToQueryStatement }).subscribe(function (res) { _this.listView.data = res.body; _this.listView.setTotal(res.headers); }); }; PostComponent.prototype.insert = function () { this.postDialog.resetForm(); this.postDialog.isDialog = false; this.postDialog.setFormValue({}); }; PostComponent.prototype.dialog = function (dataRow) { this.postDialog.resetForm(); this.postDialog.isDialog = true; this.postDialog.setFormValue(dataRow); }; PostComponent.prototype.delete = function (dataRow) { var _self = this; this.confirmServ.confirm({ title: '您确定要删除这条记录?', onOk: function () { _self.dataSource.delete(dataRow.id, { communityGroupId: _self.communityGroupId }).subscribe(function (success) { _self.loadAll(); }); } }); }; PostComponent.prototype.onSave = function (entity) { var _this = this; if (entity.id === null) { this.dataSource.create(entity, { communityGroupId: this.communityGroupId }).subscribe(function (success) { _this.postDialog.modalIsVisible = false; _this.loadAll(); }); } else { this.dataSource.update(entity, { communityGroupId: this.communityGroupId }).subscribe(function (success) { _this.postDialog.modalIsVisible = false; _this.loadAll(); }); } }; // 岗位权限 // 岗位权限 PostComponent.prototype.setPostAuthority = // 岗位权限 function () { this.authorityDialog.modalIsVisible = true; this.authorityDialog.postId = null; this.authorityDialog.loadAll(); }; PostComponent.prototype.search = function (query) { this.listView.params.queryString = query; this.loadAll(); }; PostComponent.prototype.formateEmployeeNames = function (employeeNames) { if (employeeNames.length > 0) { if (employeeNames.length > 10) { employeeNames = employeeNames.slice(0, 10); return employeeNames.join(',') + '...'; } return employeeNames.join(','); } return ''; }; PostComponent.prototype.dialogAuthority = function (dataRow) { this.authorityDialog.modalIsVisible = true; this.postId = dataRow.id; this.authorityDialog.loadAll(); }; PostComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'zx-post', template: "<zx-header-block [title]=\"'\u5C97\u4F4D\u8BBE\u7F6E'\" [showBottomLine]=\"false\" [showBreadcrumb]=\"true\"><p>\u672C\u673A\u6784\u5C97\u4F4D\u8BBE\u7F6E</p></zx-header-block><zx-content-block><ng-template #operations><button nz-button [nzType]=\"'primary'\" (click)=\"insert()\"><i class=\"anticon anticon-plus\"></i> <span>\u6DFB\u52A0\u5C97\u4F4D</span></button> <button nz-button [nzType]=\"'default'\" (click)=\"setPostAuthority()\"><i class=\"anticon anticon-unlock\"></i> <span>\u5C97\u4F4D\u6743\u9650</span></button></ng-template><ng-template #extra><nz-input [nzType]=\"'search'\" [(ngModel)]=\"listView.params.queryString\" [nzPlaceHolder]=\"'\u8BF7\u8F93\u5165\u5C97\u4F4D\u7F16\u7801\u6216\u540D\u79F0\u641C\u7D22'\" style=\"width: 250px;\" (nzOnSearch)=\"search($event)\" [nzSize]=\"'large'\"></nz-input></ng-template><ng-template #content><zx-list-view [listView]=\"listView\" (loadData)=\"loadAll()\"><ng-template #dataColumn let-dataRow=\"dataRow\" let-field=\"field\" let-value=\"value\"><div *ngIf=\"field.name == 'employeeNames'\"><nz-tooltip [nzTitle]=\"dataRow.employeeNames.join('\uFF0C')\" [nzPlacement]=\"'top'\"><span nz-tooltip>{{formateEmployeeNames(dataRow.employeeNames)}}</span></nz-tooltip></div></ng-template><ng-template #dataOperations let-dataRow=\"dataRow\"><a (click)=\"dialog(dataRow)\">\u4FEE\u6539</a> <a (click)=\"dialogAuthority(dataRow)\">\u6743\u9650</a> <a (click)=\"delete(dataRow)\">\u5220\u9664</a></ng-template></zx-list-view></ng-template></zx-content-block><zx-post-dialog #postDialog (clickSave)=\"onSave($event)\"></zx-post-dialog><zx-post-authority #authorityDialog [postId]=\"postId\"></zx-post-authority>", styles: [ "\n :host ::ng-deep .ant-select-dropdown-menu-item{\n font-size:0 !important;\n }\n " ] },] }, ]; /** @nocollapse */ PostComponent.ctorParameters = function () { return [ { type: data_source_helper_1.DataSourceHelper, }, { type: ngx_webapp_fx_1.UserStorageService, }, { type: core_1.Injector, }, { type: ng_zorro_antd_1.NzModalService, }, ]; }; PostComponent.propDecorators = { "postDialog": [{ type: core_1.ViewChild, args: ['postDialog',] },], "authorityDialog": [{ type: core_1.ViewChild, args: ['authorityDialog',] },], }; return PostComponent; }()); exports.PostComponent = PostComponent; //# sourceMappingURL=post.component.js.map