UNPKG

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

Version:

angular webapp : icpc.group.pms

212 lines 9.63 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var data_source_helper_1 = require("../../service/data-source.helper"); var ngx_webapp_fx_1 = require("@wjya/ngx-webapp-fx"); var core_1 = require("@angular/core"); var forms_1 = require("@angular/forms"); var common_1 = require("@angular/common"); var ng_zorro_antd_1 = require("ng-zorro-antd"); var def = { data: null, showOperations: false, fields: { id: { label: 'id', hidden: true, sort: { enabled: false }, query: {}, filter: { enabled: false } }, date: { label: '日期', sort: { enabled: false }, query: {}, filter: { enabled: false } }, community: { label: '小区', sort: { enabled: false }, query: {}, filter: { enabled: false } }, propertyIsFeeSum: { label: '物缴实收金额', sort: { enabled: false }, query: {}, filter: { enabled: false } }, propertyTotal: { label: '物缴应收金额', sort: { enabled: false }, query: {}, filter: { enabled: false } }, propertyNoFeeSum: { label: '物缴未缴金额', sort: { enabled: false }, query: {}, filter: { enabled: false } }, carIsFeeSum: { label: '车缴实收金额', sort: { enabled: false }, query: {}, filter: { enabled: false } }, carTotal: { label: '车缴应收金额', sort: { enabled: false }, query: {}, filter: { enabled: false } }, carNoFeeSum: { label: '车缴未缴金额', sort: { enabled: false }, query: {}, filter: { enabled: false } } } }; var SummaryComponent = /** @class */ (function () { function SummaryComponent(dataSourceHelper, injector, userStorageService, fb, datePipe, _message, confirmServ) { this.dataSourceHelper = dataSourceHelper; this.injector = injector; this.userStorageService = userStorageService; this.fb = fb; this.datePipe = datePipe; this._message = _message; this.confirmServ = confirmServ; this.queryString = null; this.sortName = 'id'; this.reverse = 'ascend'; this.communityOption = []; this.isDisable = false; this.items = []; this.dataSource = dataSourceHelper.billReport; this.exportExcelDataSource = dataSourceHelper.billReportExport; this.communityDataSource = dataSourceHelper.communities; this.generateFileStoragesDataSource = this.dataSourceHelper.generateFileStorages; this.validateForm = this.fb.group({ community: [null], date: [null], }); } SummaryComponent.prototype.ngOnInit = function () { this.listView = new ngx_webapp_fx_1.ListView(def, this.injector); this.communityGroupId = this.userStorageService.getCurrentOffice().id; this.loadAll(); }; SummaryComponent.prototype.loadAll = function () { var _this = this; this.dataSource.findList({ communityOrGroup_Id: this.communityGroupId, query: this.querys, sort: this.sort() }).subscribe(function (res) { _this.items = res.body; }); }; SummaryComponent.prototype.sort = function () { var result = [this.sortName + ',' + (this.reverse === 'ascend' ? 'asc' : 'desc')]; return result; }; SummaryComponent.prototype.query = function (event) { var filterValue = this.listView.filterValue; var sortValue = this.listView.sortValue; if (JSON.stringify(sortValue) === '{}') { this.sortName = 'id'; this.reverse = 'ascend'; } else { for (var _i = 0, _a = Object.keys(sortValue); _i < _a.length; _i++) { var key = _a[_i]; this.sortName = key; this.reverse = sortValue[key]; } } this.loadAll(); }; SummaryComponent.prototype.resetForm = function () { this.validateForm.reset(); this.loadAll(); }; SummaryComponent.prototype.search = function (e) { this.querys = e; this.loadAll(); }; SummaryComponent.prototype.convertLocalDateTimeToServer = function (date) { if (date) { return this.datePipe.transform(date, 'yyyy-MM-dd'); } else { return null; } }; SummaryComponent.prototype.exportExcel = function () { var _self = this; this.confirmServ.confirm({ title: '您确定要导出记录?', showConfirmLoading: true, onOk: function () { return new Promise(function (resolve) { _self.exportExcelDataSource.findList({ communityGroupId: _self.communityGroupId, query: _self.queryString, }).subscribe(function (success) { _self.getDownLoadUrl(success.body.fileKey, resolve); }, function (error) { _self._message.error('导出报表失败'); resolve(); }); }); }, }); }; SummaryComponent.prototype.getDownLoadUrl = function (fileKey, resolve) { var _this = this; var t = setInterval(function () { _this.generateFileStoragesDataSource.findOne(fileKey).subscribe(function (success) { if (success.body.status === 'DONE') { _this._message.success('导出报表成功'); clearInterval(t); resolve(); window.location.href = success.body.downLoadUrl; } else if (success.body.status === 'ERROR') { _this._message.error('导出报表失败'); clearInterval(t); resolve(); } }, function (error) { _this._message.error('导出报表失败'); clearInterval(t); resolve(); }); }, 1000); }; SummaryComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'zx-summary', template: "<zx-header-block [title]=\"'\u5C0F\u533A\u6C47\u603B\u7EDF\u8BA1'\" [showBottomLine]=\"false\" [showBreadcrumb]=\"true\"></zx-header-block><zx-content-block><ng-template #operations><button nz-button [nzType]=\"'primary'\" (click)=\"exportExcel()\" [disabled]=\"isDisable\"><span>\u5BFC\u51FA\u8BB0\u5F55</span></button></ng-template><ng-template #extra><nz-input [nzType]=\"'search'\" [nzPlaceHolder]=\"'\u67E5\u8BE2'\" style=\"width: 200px;vertical-align: top;\" (nzOnSearch)=\"search($event)\" [nzSize]=\"'large'\"></nz-input></ng-template><ng-template #content><nz-table #nzTable [nzDataSource]=\"items\" [nzIsPagination]=\"false\" nzShowSizeChanger [nzLoading]=\"_loading\" [nzShowQuickJumper]=\"true\" [nzSize]=\"'middle'\"><thead nz-thead><tr nz-thead-tr><th nz-th><span>\u65E5\u671F</span></th><th nz-th><span>\u5C0F\u533A</span></th><th nz-th><span>\u7269\u7F34\u5B9E\u6536\u91D1\u989D</span></th><th nz-th><span>\u7269\u7F34\u5E94\u6536\u91D1\u989D</span></th><th nz-th><span>\u7269\u7F34\u672A\u7F34\u91D1\u989D</span></th><th nz-th><span>\u8F66\u7F34\u5B9E\u6536\u91D1\u989D</span></th><th nz-th><span>\u8F66\u7F34\u5E94\u6536\u91D1\u989D</span></th><th nz-th><span>\u8F66\u7F34\u672A\u7F34\u91D1\u989D</span></th></tr></thead><tbody nz-tbody><tr nz-tbody-tr *ngFor=\"let item of items\"><td nz-td>{{item.date}}</td><td nz-td>{{item.community}}</td><td nz-td>{{item.propertyIsFeeSum}}</td><td nz-td>{{item.propertyTotal}}</td><td nz-td>{{item.propertyNoFeeSum}}</td><td nz-td>{{item.carIsFeeSum}}</td><td nz-td>{{item.carTotal}}</td><td nz-td>{{item.carNoFeeSum}}</td></tr></tbody></nz-table></ng-template></zx-content-block>", styles: [ "\n :host .serach-icon{\n padding: 8px;\n border: 1px solid #d9d9d9;\n vertical-align: middle;\n border-radius: 4px;\n cursor: pointer;\n }\n :host ::ng-deep .ant-calendar-picker{\n width:100%;\n }\n " ] },] }, ]; /** @nocollapse */ SummaryComponent.ctorParameters = function () { return [ { type: data_source_helper_1.DataSourceHelper, }, { type: core_1.Injector, }, { type: ngx_webapp_fx_1.UserStorageService, }, { type: forms_1.FormBuilder, }, { type: common_1.DatePipe, }, { type: ng_zorro_antd_1.NzMessageService, }, { type: ng_zorro_antd_1.NzModalService, }, ]; }; SummaryComponent.propDecorators = { "listControl": [{ type: core_1.ViewChild, args: ['list',] },], }; return SummaryComponent; }()); exports.SummaryComponent = SummaryComponent; //# sourceMappingURL=summary.component.js.map